From 3ce144b41b872be9fac8446b3b1cb4245c1e6842 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 1 Mar 2017 16:51:15 -0800 Subject: [PATCH] Add null check when populating popup It was crashing when there were notifications but no shortcuts. Change-Id: I92e961e6186ef24736777855e114bd3245f7ac91 --- .../launcher3/popup/PopupContainerWithArrow.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index 15dde4330d..0b0f88aaf0 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -70,6 +70,8 @@ import com.android.launcher3.shortcuts.DeepShortcutView; import com.android.launcher3.shortcuts.ShortcutsItemView; import com.android.launcher3.util.PackageUserKey; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -182,14 +184,12 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra orientAboutIcon(originalIcon, arrowHeight + arrowVerticalOffset); } - List shortcutViews = mShortcutsItemView.getDeepShortcutViews(reverseOrder); - for (int i = 0; i < itemsToPopulate.length; i++) { - switch (itemsToPopulate[i]) { - case NOTIFICATION: - IconPalette iconPalette = originalIcon.getIconPalette(); - mNotificationItemView.applyColors(iconPalette); - break; - } + List shortcutViews = mShortcutsItemView == null + ? Collections.EMPTY_LIST + : mShortcutsItemView.getDeepShortcutViews(reverseOrder); + if (mNotificationItemView != null) { + IconPalette iconPalette = originalIcon.getIconPalette(); + mNotificationItemView.applyColors(iconPalette); } // Add the arrow.