diff options
author | Arne Schwabe <arne@rfc2549.org> | 2022-08-12 15:56:41 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2022-08-12 15:56:41 +0200 |
commit | 62a4c42f42abcc202f6ccba2e5b2a2a05a259068 (patch) | |
tree | f0ae38ed0a7e2c7a244ab625f5bd899f0d47cc82 /main/src | |
parent | 328ea1b130a3b6064280f6bdc37b6f5f00e881ea (diff) |
Try to fix/workaround problems reported by Google Play console
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/LogItem.java | 5 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/LogItem.java b/main/src/main/java/de/blinkt/openvpn/core/LogItem.java index c61cbc44..144ae7c4 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/LogItem.java +++ b/main/src/main/java/de/blinkt/openvpn/core/LogItem.java @@ -18,6 +18,7 @@ import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; @@ -195,7 +196,7 @@ public class LogItem implements Parcelable { } private void marschalString(String str, ByteBuffer bb) throws UnsupportedEncodingException { - byte[] utf8bytes = str.getBytes("UTF-8"); + byte[] utf8bytes = str.getBytes(StandardCharsets.UTF_8); bb.putInt(utf8bytes.length); bb.put(utf8bytes); } @@ -204,7 +205,7 @@ public class LogItem implements Parcelable { int len = bb.getInt(); byte[] utf8bytes = new byte[len]; bb.get(utf8bytes); - return new String(utf8bytes, "UTF-8"); + return new String(utf8bytes, StandardCharsets.UTF_8); } diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java index 00f45ed4..8b2a1b1c 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java @@ -29,6 +29,10 @@ public class NetworkUtils { NetworkCapabilities nc = conn.getNetworkCapabilities(network); + // Ignore network if it has no capabilities + if (nc == null) + continue; + // Skip VPN networks like ourselves if (nc.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) continue; |