summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--qt-models/maplocationmodel.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 64ec61ce5..1d6cc2dcb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-
+- fix crash when (re-)loading maps
---
* Always add new entries at the very top of this file above other existing entries and this note.
* Use this layout for new entries: `[Area]: [Details about the change] [reference thread / issue]`
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index b1fe16b60..1acea421e 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -140,7 +140,6 @@ void MapLocationModel::reload(QObject *map)
m_selectedDs.clear();
QMap<QString, MapLocation *> locationNameMap;
- MapLocation *location;
#ifdef SUBSURFACE_MOBILE
bool diveSiteMode = false;
@@ -184,10 +183,11 @@ void MapLocationModel::reload(QObject *map)
if (dsCoord.distanceTo(coord) < MIN_DISTANCE_BETWEEN_DIVE_SITES_M)
continue;
}
- locationNameMap[name] = location;
}
- location = new MapLocation(ds, dsCoord, name);
+ MapLocation *location = new MapLocation(ds, dsCoord, name);
m_mapLocations.append(location);
+ if (!diveSiteMode)
+ locationNameMap[name] = location;
}
endResetModel();