From f8ee7dcce9748577aebef6677f9e6974c2dac03e Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Wed, 10 Jan 2018 11:13:16 -0600 Subject: QuickTileService: Fix crash opening activity Signed-off-by: Samuel Holland --- app/src/main/java/com/wireguard/android/QuickTileService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app/src/main/java/com/wireguard/android') diff --git a/app/src/main/java/com/wireguard/android/QuickTileService.java b/app/src/main/java/com/wireguard/android/QuickTileService.java index e694af4e..f23eb4ba 100644 --- a/app/src/main/java/com/wireguard/android/QuickTileService.java +++ b/app/src/main/java/com/wireguard/android/QuickTileService.java @@ -36,10 +36,13 @@ public class QuickTileService extends TileService { @Override public void onClick() { - if (tunnel != null) + if (tunnel != null) { tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished); - else - startActivityAndCollapse(new Intent(this, MainActivity.class)); + } else { + final Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivityAndCollapse(intent); + } } @Override -- cgit v1.2.3