diff options
| author | Raphael <raphael@google.com> | 2009-08-25 16:14:14 -0700 |
|---|---|---|
| committer | Raphael <raphael@google.com> | 2009-08-25 16:19:25 -0700 |
| commit | b8a74f45519830f2695b74f39fc9097659e28969 (patch) | |
| tree | fe88c0268b7037733fd46486a84442d883666b58 /tools/eclipse | |
| parent | 5837c3cc34e1408781479ea1c4d77260de288647 (diff) | |
| download | android_development-b8a74f45519830f2695b74f39fc9097659e28969.tar.gz android_development-b8a74f45519830f2695b74f39fc9097659e28969.tar.bz2 android_development-b8a74f45519830f2695b74f39fc9097659e28969.zip | |
ADT: Fix some potential NPE in the configuration composite.
This is just based on Eclipse static analysis of potential null pointers.
It doesn't mean we were ever going to have any NPE there.
Change-Id: I2a326048d2eb6afff7598f9300f48e35495ff3c2
Diffstat (limited to 'tools/eclipse')
| -rw-r--r-- | tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java index 9e67be4dd..4ed96ae2f 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java @@ -57,6 +57,9 @@ import java.util.Map; import java.util.Set; import java.util.SortedSet; +/** + * A composite that displays the current configuration displayed in a Graphical Layout Editor. + */ public class ConfigurationComposite extends Composite { private final static String THEME_SEPARATOR = "----------"; //$NON-NLS-1$ @@ -90,6 +93,12 @@ public class ConfigurationComposite extends Composite { private final IConfigListener mListener; + /** + * Interface implemented by the part which owns a {@link ConfigurationComposite}. + * This notifies the owners when the configuration change. + * The owner must also provide methods to provide the configuration that will + * be displayed. + */ public interface IConfigListener { void onConfigurationChange(); void onThemeChange(); @@ -386,7 +395,7 @@ public class ConfigurationComposite extends Composite { mLocale.add("Default"); mLocaleList.add(new ResourceQualifier[] { null, null }); - if (languages != null && languages.size() > 0) { + if (project != null && languages != null && languages.size() > 0) { for (String language : languages) { // first the language alone mLocale.add(language); @@ -402,7 +411,6 @@ public class ConfigurationComposite extends Composite { } } - } else { } mDisableUpdates = false; @@ -701,14 +709,16 @@ public class ConfigurationComposite extends Composite { } } - if (frameworkStyle) { - // if the parent is a framework style, it has to be 'Theme' or 'Theme.*' - 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); + if (parentStyle != null) { + if (frameworkStyle) { + // if the parent is a framework style, it has to be 'Theme' or 'Theme.*' + 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); + } } } } |
