summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-03-08 15:47:45 -0800
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:18:41 -0700
commitc83157f0f55b1c3733be26db07e4e4f525fb083b (patch)
tree09c6180a90a85eb732609ec390c7105faec10275
parent284aaa3fc20426f204c2d570bafa1954ab33eeee (diff)
downloadandroid_packages_apps_Trebuchet-c83157f0f55b1c3733be26db07e4e4f525fb083b.zip
android_packages_apps_Trebuchet-c83157f0f55b1c3733be26db07e4e4f525fb083b.tar.gz
android_packages_apps_Trebuchet-c83157f0f55b1c3733be26db07e4e4f525fb083b.tar.bz2
Trebuchet: Guard against NPE while querying for widget updates
Issue-id: CYNGNOS-1867 Change-Id: I43db0096da5f35bd2810f8793d8281607afea1ff
-rw-r--r--src/com/android/launcher3/LauncherModel.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 36d4877..83b5d82 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -3513,9 +3513,12 @@ public class LauncherModel extends BroadcastReceiver
// Refresh widget list, if there is any newly added widget
PackageManager pm = context.getPackageManager();
for (String pkg : mPackages) {
- needToRefresh |= !pm.queryBroadcastReceivers(
+ List<ResolveInfo> resolveInfos = pm.queryBroadcastReceivers(
new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
- .setPackage(pkg), 0).isEmpty();
+ .setPackage(pkg), 0);
+ if (resolveInfos != null) {
+ needToRefresh |= !resolveInfos.isEmpty();
+ }
}
}