aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt b/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt
index ba9aa95..a72a1aa 100644
--- a/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt
@@ -25,6 +25,7 @@ import android.content.IntentFilter
25import android.net.ConnectivityManager 25import android.net.ConnectivityManager
26import org.pacien.tincapp.commands.Tinc 26import org.pacien.tincapp.commands.Tinc
27import org.slf4j.LoggerFactory 27import org.slf4j.LoggerFactory
28import java.lang.IllegalArgumentException
28 29
29/** 30/**
30 * @author pacien 31 * @author pacien
@@ -55,6 +56,10 @@ object ConnectivityChangeReceiver : BroadcastReceiver() {
55 } 56 }
56 57
57 fun unregisterWatcher(context: Context) { 58 fun unregisterWatcher(context: Context) {
58 context.unregisterReceiver(this) 59 try {
60 context.unregisterReceiver(this)
61 } catch (e: IllegalArgumentException) {
62 // already unregistered
63 }
59 } 64 }
60} 65}