diff options
author | Arne Schwabe <arne@rfc2549.org> | 2021-10-07 15:39:28 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2021-10-07 15:39:28 +0200 |
commit | 881d82ebd5cdd5588ef41cb1cacacb27988f61a6 (patch) | |
tree | fc2d90b725de244e340f20f27e7f6b2e94784e46 | |
parent | 706f3d28ab839369d0036299c4ee77d12b776a9a (diff) |
Fix two small issues reported in crashes from Play Console
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java | 2 | ||||
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt | 8 |
2 files changed, 7 insertions, 3 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 bcf0e898..74244c35 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java @@ -453,7 +453,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { String proxyname = null;
boolean proxyUseAuth = false;
- if (mProfile.mConnections != null && mProfile.mConnections.length > connectionEntryNumber) {
+ if (mProfile != null && mProfile.mConnections != null && mProfile.mConnections.length > connectionEntryNumber) {
Connection connection = mProfile.mConnections[connectionEntryNumber];
proxyType = connection.mProxyType;
proxyname = connection.mProxyName;
diff --git a/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt b/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt index 73a3f75e..725f466c 100644 --- a/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt +++ b/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt @@ -12,6 +12,7 @@ import android.app.AlertDialog import android.content.ActivityNotFoundException import android.content.Intent import android.content.pm.PackageManager +import android.database.Cursor import android.net.Uri import android.os.AsyncTask import android.os.Build @@ -650,9 +651,9 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener mPathsegments = data.pathSegments - val cursor = contentResolver.query(data, null, null, null, null) - + var cursor:Cursor? = null try { + cursor = contentResolver.query(data, null, null, null, null) if (cursor != null && cursor.moveToFirst()) { var columnIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME) @@ -667,6 +668,9 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener log("Mime type: " + cursor.getString(columnIndex)) } } + } + catch (se:SecurityException) { + log("Importing failed: ${se.localizedMessage}") } finally { cursor?.close() } |