diff options
author | cyBerta <cyberta@riseup.net> | 2019-06-12 17:42:32 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-08-02 01:49:37 +0200 |
commit | 386c580a9a97870f500bf277a1d1ec25a8f4a056 (patch) | |
tree | 8d80dc275f6adf8e34ca00bc5129c04f58b2df9e /app/src/main | |
parent | 04df0d72d5f085a60e3b75b1b7df6244f04940f0 (diff) |
add null checks for the case shapeshifter-dispatcher is not running
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 55a92cb0..b775921c 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -248,7 +248,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac if(isVpnRunning()) { if (getManagement() != null && getManagement().stopVPN(replaceConnection)) { if (!replaceConnection) { - if (dispatcher.isRunning()) { + if (dispatcher != null && dispatcher.isRunning()) { dispatcher.stop(); } VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); @@ -258,7 +258,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac return false; } else { if (!replaceConnection) { - if (dispatcher.isRunning()) { + if (dispatcher != null && dispatcher.isRunning()) { dispatcher.stop(); } VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); @@ -395,7 +395,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac obfs4Connection.getmObfs4IatMode()); dispatcher.initSync(); - if (dispatcher.getPort() != null && dispatcher.getPort().length() > 0) { + if (dispatcher.isRunning()) { connection.setServerPort(dispatcher.getPort()); Log.d(TAG, "Dispatcher running. Profile server name and port: " + connection.getServerName() + ":" + connection.getServerPort()); |