From a96bf491b7009f5836ef26479768c2a65e9ffd99 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Fri, 21 Jun 2019 14:21:44 +0300 Subject: [PATCH] fix for issue 6971 --- OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index 3b406007f5..6af6dd75ee 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -135,12 +135,14 @@ public class FavouritesDbHelper { } } - private void removeFromMarkers(FavoriteGroup favGroup) { + private boolean removeFromMarkers(FavoriteGroup favGroup) { MapMarkersHelper helper = context.getMapMarkersHelper(); MapMarkersGroup group = helper.getMarkersGroup(favGroup); if(group != null) { helper.removeMarkersGroup(group); + return true; } + return false; } private void addToMarkers(FavoriteGroup favGroup) { @@ -650,7 +652,7 @@ public class FavouritesDbHelper { } if (!group.name.equals(newName)) { FavoriteGroup gr = flatGroups.remove(group.name); - removeFromMarkers(gr); + boolean isInMarkers = removeFromMarkers(gr); gr.name = newName; FavoriteGroup renamedGroup = flatGroups.get(gr.name); boolean existing = renamedGroup != null; @@ -666,7 +668,9 @@ public class FavouritesDbHelper { renamedGroup.points.add(p); } } - addToMarkers(renamedGroup); + if (isInMarkers) { + addToMarkers(renamedGroup); + } } saveCurrentPointsIntoFile(); }