diff options
author | cyBerta <cyberta@riseup.net> | 2021-11-07 04:58:10 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-11-07 04:58:10 +0100 |
commit | 2bb2713ec024e687a563adcb706ca9544e4a8b84 (patch) | |
tree | 55d0eff61f02cb7cd52ae0b0cfd2b093ffcb1d99 /app | |
parent | f40d0b95feabc35903a0c646150c36ed205edd24 (diff) |
catch possible IllegalStateException within stopService
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java | 11 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java index 65810861..335d70b2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java @@ -175,10 +175,15 @@ public class ProviderAPI extends JobIntentService implements ProviderApiManagerB } @Override - public void stopTorService() throws IllegalStateException { + public void stopTorService() { closeTorServiceConnection(); - Intent stopIntent = new Intent(this, TorService.class); - stopService(stopIntent); + try { + Intent stopIntent = new Intent(this, TorService.class); + stopService(stopIntent); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } @Override diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java index c385c4c4..0853f96d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java @@ -150,7 +150,7 @@ public abstract class ProviderApiManagerBase { public interface ProviderApiServiceCallback { void broadcastEvent(Intent intent); void startTorService() throws InterruptedException, IllegalStateException; - void stopTorService() throws IllegalStateException; + void stopTorService(); int getTorHttpTunnelPort(); boolean isConnectedToWifi(); } |