From f00dc6a373e5a05598285c4ca6e8e7758b3cc38d Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 27 Nov 2015 09:26:34 +0100 Subject: [PATCH] Disable NetGuard if VPN dialog fails --- app/src/main/java/eu/faircode/netguard/ActivityMain.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 6800233c..65fc5158 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -133,6 +133,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityMain.this); onActivityResult(REQUEST_VPN, RESULT_CANCELED, null); + prefs.edit().putBoolean("enabled", false).apply(); } } } @@ -147,9 +148,12 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences dialogVpn.show(); } } catch (Throwable ex) { + // Prepare failed Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Util.sendCrashReport(ex, ActivityMain.this); + prefs.edit().putBoolean("enabled", false).apply(); } + } else { Log.i(TAG, "Switch off"); prefs.edit().putBoolean("enabled", false).apply();