From 43637659860bc5cf6506c1520a2d8d83f35d64be Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 19 May 2022 12:29:58 +0200 Subject: early return if tor is ment to be shutdown but is not running --- app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') 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(); } -- cgit v1.2.3