OSDN Git Service

ADT: Fix NPE in ConfigComposite
authorRaphael Moll <ralf@android.com>
Tue, 29 Jun 2010 21:52:16 +0000 (14:52 -0700)
committerRaphael Moll <ralf@android.com>
Tue, 29 Jun 2010 21:52:39 +0000 (14:52 -0700)
For some reason the locale used by the ConfigState in the
ConfigurationComposite had null members. Failed to reproduce
it. One clue might be there was a non-selected GLE2 open
as an editor tab but the Java workspace was not the main
visible one. It's possible some event fired before the
composite controls got created.

Change-Id: I2c8b6c86842f3c772c2a7ec113941eb8fc01b9e4

eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java

index 89285bf..4b1d5f6 100644 (file)
@@ -189,9 +189,12 @@ public class ConfigurationComposite extends Composite {
                 sb.append(configName);
                 sb.append(SEP);
                 if (locale != null) {
-                    sb.append(((LanguageQualifier) locale[0]).getValue());
-                    sb.append(SEP_LOCALE);
-                    sb.append(((RegionQualifier) locale[1]).getValue());
+                    if (locale[0] != null && locale[1] != null) {
+                        // locale[0]/[1] can be null sometimes when starting Eclipse
+                        sb.append(((LanguageQualifier) locale[0]).getValue());
+                        sb.append(SEP_LOCALE);
+                        sb.append(((RegionQualifier) locale[1]).getValue());
+                    }
                 }
                 sb.append(SEP);
                 sb.append(theme);