fix for issue 6971

This commit is contained in:
madwasp79 2019-06-21 14:21:44 +03:00
parent c3a9dc2e60
commit a96bf491b7

View file

@ -135,12 +135,14 @@ public class FavouritesDbHelper {
} }
} }
private void removeFromMarkers(FavoriteGroup favGroup) { private boolean removeFromMarkers(FavoriteGroup favGroup) {
MapMarkersHelper helper = context.getMapMarkersHelper(); MapMarkersHelper helper = context.getMapMarkersHelper();
MapMarkersGroup group = helper.getMarkersGroup(favGroup); MapMarkersGroup group = helper.getMarkersGroup(favGroup);
if(group != null) { if(group != null) {
helper.removeMarkersGroup(group); helper.removeMarkersGroup(group);
return true;
} }
return false;
} }
private void addToMarkers(FavoriteGroup favGroup) { private void addToMarkers(FavoriteGroup favGroup) {
@ -650,7 +652,7 @@ public class FavouritesDbHelper {
} }
if (!group.name.equals(newName)) { if (!group.name.equals(newName)) {
FavoriteGroup gr = flatGroups.remove(group.name); FavoriteGroup gr = flatGroups.remove(group.name);
removeFromMarkers(gr); boolean isInMarkers = removeFromMarkers(gr);
gr.name = newName; gr.name = newName;
FavoriteGroup renamedGroup = flatGroups.get(gr.name); FavoriteGroup renamedGroup = flatGroups.get(gr.name);
boolean existing = renamedGroup != null; boolean existing = renamedGroup != null;
@ -666,7 +668,9 @@ public class FavouritesDbHelper {
renamedGroup.points.add(p); renamedGroup.points.add(p);
} }
} }
addToMarkers(renamedGroup); if (isInMarkers) {
addToMarkers(renamedGroup);
}
} }
saveCurrentPointsIntoFile(); saveCurrentPointsIntoFile();
} }