summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java2
-rw-r--r--main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt8
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()
}