diff options
author | Arne Schwabe <arne@rfc2549.org> | 2021-10-09 18:26:16 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2021-10-09 18:26:16 +0200 |
commit | ddc7c919c2c20c888518da38b7ed5d283e1b0a39 (patch) | |
tree | 7560eaf95f9cdfa8fcca5450eda97a4a42a65412 /main | |
parent | ab67684d37a81077312df6e894f282a9b83879dd (diff) |
Fix some corner case NPE report by play console
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java | 6 | ||||
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/activities/VPNPreferences.java | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java index 74244c35..e4123838 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java @@ -468,7 +468,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { }
// atuo detection of proxy
- if (proxyType == Connection.ProxyType.NONE) {
+ if (proxyType == Connection.ProxyType.NONE && mProfile != null) {
SocketAddress proxyaddr = ProxyDetection.detectProxy(mProfile);
if (proxyaddr instanceof InetSocketAddress) {
InetSocketAddress isa = (InetSocketAddress) proxyaddr;
@@ -476,11 +476,9 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { proxyname = isa.getHostName();
proxyport = String.valueOf(isa.getPort());
proxyUseAuth = false;
-
}
}
-
if (args.length >= 2 && proxyType == Connection.ProxyType.HTTP) {
String proto = args[1];
if (proto.equals("UDP")) {
@@ -489,7 +487,6 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { }
}
-
if (proxyType == Connection.ProxyType.ORBOT) {
VpnStatus.updateStateString("WAIT_ORBOT", "Waiting for Orbot to start", R.string.state_waitorbot, ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET);
OrbotHelper orbotHelper = OrbotHelper.get(mOpenVPNService);
@@ -500,7 +497,6 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { orbotHelper.addStatusCallback(mOpenVPNService, statusCallback);
orbotHelper.sendOrbotStartAndStatusBroadcast();
-
} else {
sendProxyCMD(proxyType, proxyname, proxyport, proxyUseAuth);
}
diff --git a/main/src/ui/java/de/blinkt/openvpn/activities/VPNPreferences.java b/main/src/ui/java/de/blinkt/openvpn/activities/VPNPreferences.java index 49d4161c..2c9eb761 100644 --- a/main/src/ui/java/de/blinkt/openvpn/activities/VPNPreferences.java +++ b/main/src/ui/java/de/blinkt/openvpn/activities/VPNPreferences.java @@ -115,12 +115,16 @@ public class VPNPreferences extends BaseActivity { if(savedUUID!=null) mProfileUUID=savedUUID; } + super.onCreate(savedInstanceState); mProfile = ProfileManager.get(this,mProfileUUID); - if(mProfile!=null) { - setTitle(getString(R.string.edit_profile_title, mProfile.getName())); + if(mProfile==null) { + Toast.makeText(this, "Profile to edit cannot be found.", Toast.LENGTH_LONG).show(); + finish(); + return; } - super.onCreate(savedInstanceState); + + setTitle(getString(R.string.edit_profile_title, mProfile.getName())); setContentView(R.layout.main_activity); |