QuickTileService: sometimes tile is null

According to play store reports, such as:

wt88047, 0MB RAM, Android 8.1
java.lang.NullPointerException:
at com.wireguard.android.QuickTileService.updateTile (QuickTileService.java:97)
at com.wireguard.android.QuickTileService.onStartListening (QuickTileService.java:56)
at android.service.quicksettings.TileService$H.handleMessage (TileService.java:407)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6520)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:442)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-01-10 00:41:28 +01:00
parent c6bdeb1d45
commit 138ba5c416

View File

@ -94,6 +94,8 @@ public class QuickTileService extends TileService {
label = getString(R.string.app_name);
state = Tile.STATE_INACTIVE;
}
if (tile == null)
return;
tile.setLabel(label);
if (tile.getState() != state) {
// The icon must be changed every time the state changes, or the shade will not change.