diff options
author | cyBerta <cyberta@riseup.net> | 2022-05-19 12:29:58 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2022-05-19 12:29:58 +0200 |
commit | 43637659860bc5cf6506c1520a2d8d83f35d64be (patch) | |
tree | c7ea82e0ac7df532c4f388f660d675c6b5a41445 /app/src/main | |
parent | 378dc870c6dca3c5186a311fbc9c90e560653a2d (diff) |
early return if tor is ment to be shutdown but is not running
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java index 0f721013..b99abb3d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java @@ -81,7 +81,8 @@ public class TorServiceCommand { @WorkerThread public static void stopTorService(Context context) { - if (TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.OFF) { + if (TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.STOPPING || + TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.OFF) { return; } TorStatusObservable.markCancelled(); @@ -102,6 +103,9 @@ public class TorServiceCommand { } public static void stopTorServiceAsync(Context context) { + if (!TorStatusObservable.isRunning()) { + return; + } TorStatusObservable.markCancelled(); new Thread(() -> stopTorService(context)).start(); } |