Disable NetGuard if VPN dialog fails

This commit is contained in:
M66B 2015-11-27 09:26:34 +01:00
parent 3291ecc501
commit f00dc6a373
1 changed files with 4 additions and 0 deletions

View File

@ -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();