Closed yujincheng08 closed 2 years ago
Retraced stacktrace
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.service.quicksettings.Tile.setState(int)' on a null object reference
at moe.haruue.wadb.service.WadbTileService.showStateOff(WadbTileService.java:106)
at moe.haruue.wadb.service.WadbTileService.onStartListening(WadbTileService.java:55)
at android.service.quicksettings.TileService$H.handleMessage(TileService.java:446)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8261)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
According to the [API reference](https://developer.android.com/reference/android/service/quicksettings/TileService#getQsTile()):
This tile may be used to get or set the current state for this tile. This tile is only valid for updates between
onStartListening()
andonStopListening()
.
And we got tile == null
in the onStartListening()
callback?
So maybe we should fix this by just checking the tile != null
before calling Tile.setState()
.
MIUI Android 12