From c57140881530833e2b7ea8e57b0ca29ba1023017 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Tue, 28 Aug 2018 19:20:30 +0300 Subject: [PATCH] Fix NPE --- OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java | 2 +- OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java index 96603cb4ea..5304690f7f 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ImportHelper.java @@ -108,7 +108,7 @@ public class ImportHelper { return false; } - public void handleFavouritesImport(Uri uri) { + public void handleFavouritesImport(@NonNull Uri uri) { String scheme = uri.getScheme(); boolean isFileIntent = "file".equals(scheme); boolean isContentIntent = "content".equals(scheme); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java index 5c30bf73c3..6111cfce2c 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java @@ -141,9 +141,8 @@ public class FavoritesActivity extends TabActivity { } } } else if (requestCode == IMPORT_FAVOURITES_REQUEST && resultCode == Activity.RESULT_OK) { - if (data != null) { - Uri uri = data.getData(); - importHelper.handleFavouritesImport(uri); + if (data != null && data.getData() != null) { + importHelper.handleFavouritesImport(data.getData()); } } else { super.onActivityResult(requestCode, resultCode, data);