From 713122de199878fbe63e7bac3667ac04461a94f2 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Thu, 19 May 2011 14:44:02 -0700 Subject: [PATCH] Fix potential stackoverflow in theme detection. Change-Id: I19d2a3c9c6802b3e1c065ca36828d2b672130630 --- .../editors/layout/configuration/ConfigurationComposite.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java index fbca2f39b..1ef6f80f8 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java @@ -2275,9 +2275,12 @@ public class ConfigurationComposite extends Composite { return parentStyle.equals("Theme") || parentStyle.startsWith("Theme."); } else { // if it's a project style, we check this is a theme. - value = styleMap.get(parentStyle); - if (value != null) { - return isTheme(value, styleMap); + ResourceValue parentValue = styleMap.get(parentStyle); + + // also prevent stackoverflow in case the dev mistakenly declared + // the parent of the style as the style itfself. + if (parentValue != null && parentValue.equals(value) == false) { + return isTheme(parentValue, styleMap); } } } -- 2.11.0