From f0b55f1e2b53fcee1f6ca9871b62322ba25d108d Mon Sep 17 00:00:00 2001 From: jhonboy121 Date: Mon, 3 Oct 2022 15:46:59 +0530 Subject: SystemUI: Fix NPE in CastTile E AndroidRuntime: FATAL EXCEPTION: main E AndroidRuntime: Process: com.android.systemui, PID: 1487 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'boolean com.android.systemui.statusbar.connectivity.IconState.visible' on a null object reference in method 'void com.android.systemui.qs.tiles.CastTile$1.setWifiIndicators(com.android.systemui.statusbar.connectivity.WifiIndicators)' E AndroidRuntime: at com.android.systemui.qs.tiles.CastTile$1.setWifiIndicators(CastTile.java:31) E AndroidRuntime: at com.android.wm.shell.bubbles.Bubble$$ExternalSyntheticLambda1.run(R8$$SyntheticClass:138) E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:942) E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7964) E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942) Change-Id: I98b83b4d18f5d842ff3063b8ddba5c9f38f76b23 --- packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index 58585e09d85b..aede72b65860 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -303,7 +303,8 @@ public class CastTile extends QSTileImpl { refreshState(); } } else { - boolean enabledAndConnected = indicators.enabled && indicators.qsIcon.visible; + boolean enabledAndConnected = indicators.enabled && + (indicators.qsIcon != null) && indicators.qsIcon.visible; if (enabledAndConnected != mWifiConnected) { mWifiConnected = enabledAndConnected; // Hotspot is not connected, so changes here should update -- cgit v1.2.3