Merge pull request #7074 from osmandapp/issue_6971

fix for issue 6971
This commit is contained in:
Alexey 2019-06-21 18:39:23 +03:00 committed by GitHub
commit 1a57650305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}