diff options
author | Arne Schwabe <arne@rfc2549.org> | 2021-10-06 16:26:03 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2021-10-06 16:58:03 +0200 |
commit | eecf3dbf9b51b23d12b99e6f008ea37f06e9b71f (patch) | |
tree | ccacf7e0af26503d422cfcd6ce30722bada62811 | |
parent | 3166e5229ce512c2424beed9514ab8d76dde2204 (diff) |
Fix NPE in Toast on Android TV (closes #1370)
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 22 | ||||
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 3fd08553..49ae56bb 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -320,17 +320,17 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // Check if running on a TV if (runningOnAndroidTV() && !(priority < 0)) - guiHandler.post(new Runnable() { - - @Override - public void run() { - - if (mlastToast != null) - mlastToast.cancel(); - String toastText = String.format(Locale.getDefault(), "%s - %s", mProfile.mName, msg); - mlastToast = Toast.makeText(getBaseContext(), toastText, Toast.LENGTH_SHORT); - mlastToast.show(); - } + guiHandler.post(() -> { + if (mlastToast != null) + mlastToast.cancel(); + String name; + if (mProfile != null) + name = mProfile.mName; + else + name = "OpenVPN"; + String toastText = String.format(Locale.getDefault(), "%s - %s", name, msg); + mlastToast = Toast.makeText(getBaseContext(), toastText, Toast.LENGTH_SHORT); + mlastToast.show(); }); } diff --git a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java index a6a1054d..aa9ec2e8 100644 --- a/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java +++ b/main/src/ui/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java @@ -172,7 +172,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable config.setContent(vpnconfig); config.setTunPersist(mVp.mPersistTun); config.setGuiVersion(mVp.getVersionEnvString(mService)); - config.setSsoMethods("openurl,webauth,`crtext"); + config.setSsoMethods("openurl,webauth,crtext"); config.setPlatformVersion(mVp.getPlatformVersionEnvString()); config.setExternalPkiAlias("extpki"); config.setCompressionMode("asym"); |