From 386c580a9a97870f500bf277a1d1ec25a8f4a056 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 12 Jun 2019 17:42:32 +0200 Subject: add null checks for the case shapeshifter-dispatcher is not running --- app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/src/main') 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()); -- cgit v1.2.3