From 94c80894d22281646a1e81018bcd52317e11f727 Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Thu, 22 Oct 2020 19:51:28 -0400 Subject: [PATCH] Fix NPE when there are no non-empty sections This appears to be a race condition somewhere in the HUN handling code. Bug: 171427279 Test: manual Change-Id: I1bb5d89313221ab46c80d39d40f51d1d488d6303 --- .../notification/stack/NotificationStackScrollLayout.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 93204995c5b0e..5cee5bd0cc4ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -1340,8 +1340,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.COORDINATOR) private float getAppearStartPosition() { if (isHeadsUpTransition()) { - return mHeadsUpInset - + getFirstVisibleSection().getFirstVisibleChild().getPinnedHeadsUpHeight(); + final NotificationSection firstVisibleSection = getFirstVisibleSection(); + final int pinnedHeight = firstVisibleSection != null + ? firstVisibleSection.getFirstVisibleChild().getPinnedHeadsUpHeight() + : 0; + return mHeadsUpInset + pinnedHeight; } return getMinExpansionHeight(); }