From aa2b2d229e3bc8e07dd5f7dc9998dc77f80518a1 Mon Sep 17 00:00:00 2001 From: Quentin Gliosca Date: Mon, 5 Feb 2024 12:08:21 +0100 Subject: [PATCH] Fix empty cursor --- .../mobi/maptrek/maps/plugin/PluginTileSourceFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/mobi/maptrek/maps/plugin/PluginTileSourceFactory.java b/app/src/main/java/mobi/maptrek/maps/plugin/PluginTileSourceFactory.java index cfa3cc89..8e8288fa 100644 --- a/app/src/main/java/mobi/maptrek/maps/plugin/PluginTileSourceFactory.java +++ b/app/src/main/java/mobi/maptrek/maps/plugin/PluginTileSourceFactory.java @@ -199,7 +199,11 @@ static List getMaps(@NonNull ContentProviderClient client, @NonNull St if (cursor == null) return maps; - cursor.moveToFirst(); + if (!cursor.moveToFirst()) { + cursor.close(); + return maps; + } + do { // map name int nameIdx = cursor.getColumnIndex(PluginTileSourceContract.COLUMN_NAME);