From 0553824a9a49830a57e0c49eece8f1ec8e1da31a Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Tue, 13 Dec 2022 16:14:40 -0500 Subject: [PATCH] Fix NPE Apparently, this can cause an NPE when there are multiple displays. Someone sent us review.git.corp.google.com/c/platform/frameworks/base/+/2296938 and the problem will reoccur if we don't fix it in that code's new location. Bug: 256539657 Test: presubmits Change-Id: I2c08bb5606bc8af7f3da0f3034c58b5d57b1be0f --- .../com/android/systemui/navigationbar/NavigationBar.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index d762b39fa1af8..db7d66edc4b2f 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -1290,8 +1290,10 @@ public class NavigationBar extends ViewController implements } private void onVerticalChanged(boolean isVertical) { - mCentralSurfacesOptionalLazy.get().ifPresent(statusBar -> - statusBar.getNotificationPanelViewController().setQsScrimEnabled(!isVertical)); + Optional cs = mCentralSurfacesOptionalLazy.get(); + if (cs.isPresent() && cs.get().getNotificationPanelViewController() != null) { + cs.get().getNotificationPanelViewController().setQsScrimEnabled(!isVertical); + } } private boolean onNavigationTouch(View v, MotionEvent event) {