From 81469702f32be538b5efedbf65f6688785708153 Mon Sep 17 00:00:00 2001 From: tiansiming Date: Sun, 14 Jan 2018 16:46:05 +0800 Subject: [PATCH] Fix NPE crash in AppInfoBase This crash can hardly happen under the normal operation of the user, but it may have a chance to appear in monkey test. To enhance the robustness of the program, intent.getData() here should not be null in any situations. Bug: N/A Test: adb shell am start -n 'com.android.settings/.Settings\$AppDrawOverlaySettingsActivity' Change-Id: I732b564056e3e585405f146d99efe3b410edbc41 Signed-off-by: tiansiming --- src/com/android/settings/applications/AppInfoBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/applications/AppInfoBase.java b/src/com/android/settings/applications/AppInfoBase.java index e422076ba8c..2aa3b0be52d 100644 --- a/src/com/android/settings/applications/AppInfoBase.java +++ b/src/com/android/settings/applications/AppInfoBase.java @@ -138,7 +138,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment if (mPackageName == null) { Intent intent = (args == null) ? getActivity().getIntent() : (Intent) args.getParcelable("intent"); - if (intent != null) { + if (intent != null && intent.getData() != null) { mPackageName = intent.getData().getSchemeSpecificPart(); } }