From 1b876fc93bd502eaf6b7022cb1311286b60b45b9 Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 28 Nov 2019 14:22:42 +0200 Subject: [PATCH] Fix possible IllegalArgumentException due to npe inside sql db --- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 0c97bce910..623bbfb2b9 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -501,8 +501,9 @@ public class GPXDatabase { } private String getFileDir(File itemFile) { - return itemFile.getParentFile() == null ? "" + String fileDir = itemFile.getParentFile() == null ? "" : new File(itemFile.getPath().replace(context.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath() + "/", "")).getParent(); + return fileDir != null ? fileDir : ""; } void insert(GpxDataItem item, SQLiteConnection db) {