From 1a3094e731ceaa35c086e0e90e56f5f8e766753c Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Thu, 19 Jul 2012 15:36:38 -0700 Subject: Prevent NPE when activating layouts that have been deleted Change-Id: I78af9a552757f3e28369d5f2de112541b1a8ea98 --- .../editors/layout/configuration/ConfigurationComposite.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'eclipse') 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 529a9a9..692d1ce 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 @@ -3139,7 +3139,7 @@ public class ConfigurationComposite extends Composite implements SelectionListen Pair pair = loadRenderState(); // Only sync the locale if this layout is not already a locale-specific layout! - if (!isLocaleSpecificLayout()) { + if (pair != null && !isLocaleSpecificLayout()) { ResourceQualifier[] locale = pair.getFirst(); if (locale != null) { localeChanged = setLocaleCombo(locale[0], locale[1]); @@ -3147,7 +3147,7 @@ public class ConfigurationComposite extends Composite implements SelectionListen } // Sync render target - IAndroidTarget target = pair.getSecond(); + IAndroidTarget target = pair != null ? pair.getSecond() : getSelectedTarget(); if (target != null) { if (getRenderingTarget() != target) { selectTarget(target); @@ -3202,6 +3202,10 @@ public class ConfigurationComposite extends Composite implements SelectionListen */ private Pair loadRenderState() { IProject project = mEditedFile.getProject(); + if (!project.isAccessible()) { + return null; + } + try { String data = project.getPersistentProperty(NAME_RENDER_STATE); if (data != null) { -- cgit v1.1