summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-03-10 19:21:38 +0100
committerArne Schwabe <arne@rfc2549.org>2014-03-10 19:21:38 +0100
commit718e01c219b030b90e0714c6af65c860719b9cfc (patch)
treea7fb447730ca06f2dbd4b911d13b9ef49a008a47
parent377c086f35d78312cb9da787f8647e989d89037f (diff)
Fix NPE reported by dev console
-rw-r--r--main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java b/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java
index 9dee3557..92356a20 100644
--- a/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java
+++ b/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java
@@ -527,22 +527,25 @@ public class ConfigConverter extends Activity implements FileSelectCallback {
InputStream is = getContentResolver().openInputStream(data);
mPathsegments = data.getPathSegments();
+ Cursor cursor = null;
+ if (data!=null)
+ cursor = getContentResolver().query(data, null, null, null, null);
+
- Cursor cursor = getContentResolver().query(data, null, null, null, null);
try {
if (cursor!=null && cursor.moveToFirst()) {
- int cidx = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
+ int columnIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
- if (cidx != -1) {
- String displayName = cursor.getString(cidx);
+ if (columnIndex != -1) {
+ String displayName = cursor.getString(columnIndex);
if (displayName != null)
possibleName = displayName;
}
- cidx = cursor.getColumnIndex("mime_type");
- if (cidx != -1) {
- log("Opening Mime TYPE: " + cursor.getString(cidx));
+ columnIndex = cursor.getColumnIndex("mime_type");
+ if (columnIndex != -1) {
+ log("Opening Mime TYPE: " + cursor.getString(columnIndex));
}
}
} finally {