OSDN Git Service

Fix bug #21025020 Stability: JCs in Settings: Caused by: java.lang.NullPointerException
authorFabrice Di Meglio <fdimeglio@google.com>
Thu, 14 May 2015 21:20:45 +0000 (14:20 -0700)
committerThe Android Automerger <android-build@google.com>
Thu, 14 May 2015 21:48:41 +0000 (14:48 -0700)
- prevent the NPE

Change-Id: Ief5a618e789e50eebcaa4386bd9ecec2192b4565

src/com/android/settings/applications/InstalledAppDetails.java

index 5b510eb..c364585 100755 (executable)
@@ -284,12 +284,15 @@ public class InstalledAppDetails extends AppInfoBase
         mBatteryPreference.setOnPreferenceClickListener(this);
 
         mLaunchPreference = findPreference(KEY_LAUNCH);
-        if ((mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0) {
-            mLaunchPreference.setEnabled(false);
-        } else if (!mAppEntry.info.enabled) {
-            mLaunchPreference.setEnabled(false);
+        if (mAppEntry.info != null) {
+            if ((mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0 ||
+                    !mAppEntry.info.enabled) {
+                mLaunchPreference.setEnabled(false);
+            } else {
+                mLaunchPreference.setOnPreferenceClickListener(this);
+            }
         } else {
-            mLaunchPreference.setOnPreferenceClickListener(this);
+            mLaunchPreference.setEnabled(false);
         }
     }