Handle race condition with outher VPN solutions

This commit is contained in:
M66B 2015-11-13 11:35:42 +01:00
parent 14b0aea105
commit b533b2c98a
1 changed files with 3 additions and 1 deletions

View File

@ -109,6 +109,8 @@ public class SinkholeService extends VpnService {
vpn = startVPN(); vpn = startVPN();
startDebug(vpn); startDebug(vpn);
} }
if (vpn == null)
prefs.edit().putBoolean("enabled", false).apply();
removeDisabledNotification(); removeDisabledNotification();
Widget.updateWidgets(SinkholeService.this); Widget.updateWidgets(SinkholeService.this);
break; break;
@ -209,7 +211,7 @@ public class SinkholeService extends VpnService {
} }
private void startDebug(final ParcelFileDescriptor pfd) { private void startDebug(final ParcelFileDescriptor pfd) {
if (!debug) if (pfd == null || !debug)
return; return;
thread = new Thread(new Runnable() { thread = new Thread(new Runnable() {