QuickTileService: fix null pointer dereference

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-07-19 20:52:28 +02:00
parent 3b0e0c2f16
commit 60a6e29350

View File

@ -72,8 +72,10 @@ public class QuickTileService extends TileService {
public void onClick() { public void onClick() {
if (tunnel != null) { if (tunnel != null) {
final Tile tile = getQsTile(); final Tile tile = getQsTile();
tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn); if (tile != null) {
tile.updateTile(); tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn);
tile.updateTile();
}
tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished); tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished);
} else { } else {
final Intent intent = new Intent(this, MainActivity.class); final Intent intent = new Intent(this, MainActivity.class);