Handle on destroy stop exceptions

This commit is contained in:
M66B 2016-01-24 08:58:52 +01:00
parent e965043116
commit 977f15822c
1 changed files with 9 additions and 4 deletions

View File

@ -1121,11 +1121,16 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
subscriptionsChangedListener = null;
}
if (vpn != null) {
jni_stop(vpn.getFd(), true);
stopVPN(vpn);
vpn = null;
try {
if (vpn != null) {
jni_stop(vpn.getFd(), true);
stopVPN(vpn);
vpn = null;
}
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
jni_done();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);