From 6da9c32204347d0980d3e76a5ff03bc3431b49a7 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 14 Apr 2015 11:50:44 -0700 Subject: Fix null pointer exception in WidgetsModel Due to not clearing the PackageItemInfos list when uninstall happened, uninstalled PackageItemInfo lingered around when there wasn't associated Widgets to it. Hence causing null pointer exception. b/20216900 Change-Id: I5601cf618079044d24ffc3ee835c1468fa2e9371 --- src/com/android/launcher3/widget/WidgetsModel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/android/launcher3/widget/WidgetsModel.java b/src/com/android/launcher3/widget/WidgetsModel.java index 1447befb2..71a7b9446 100644 --- a/src/com/android/launcher3/widget/WidgetsModel.java +++ b/src/com/android/launcher3/widget/WidgetsModel.java @@ -71,8 +71,10 @@ public class WidgetsModel { // Temporary list for {@link PackageItemInfos} to avoid having to go through // {@link mPackageItemInfos} to locate the key to be used for {@link #mWidgetsList} HashMap tmpPackageItemInfos = new HashMap<>(); + // clear the lists. mWidgetsList.clear(); + mPackageItemInfos.clear(); // add and update. for (Object o: widgetsShortcuts) { -- cgit v1.2.3