aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-03 17:44:09 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-04 14:26:21 +0100
commit92ba4b9cc7bbc2e1818191745d1976f9b915be9a (patch)
tree91fa732736dae61c3118ae6e600f51e72c5dc3df /mobile-widgets
parente3580eda6f41a34f3662ad8ae9284adb48a38142 (diff)
downloadsubsurface-92ba4b9cc7bbc2e1818191745d1976f9b915be9a.tar.gz
Replace QMap::operator[] with QMap::value()
QMap::operator[] creates a new default constructed entry in the map if no entry with the given key exists. While not problematic (since typically nullptrs are inserted) this is usually not what you want for read access. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmapwidgethelper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp
index 1ad5503dc..ba197f63f 100644
--- a/mobile-widgets/qmlmapwidgethelper.cpp
+++ b/mobile-widgets/qmlmapwidgethelper.cpp
@@ -113,7 +113,7 @@ void MapWidgetHelper::reloadMapLocations()
QString name(ds->name);
// don't add dive locations with the same name, unless they are
// at least MIN_DISTANCE_BETWEEN_DIVE_SITES_M apart
- if (locationNameMap[name]) {
+ if (locationNameMap.contains(name)) {
MapLocation *existingLocation = locationNameMap[name];
QGeoCoordinate coord = qvariant_cast<QGeoCoordinate>(existingLocation->getRole(MapLocation::Roles::RoleCoordinate));
if (dsCoord.distanceTo(coord) < MIN_DISTANCE_BETWEEN_DIVE_SITES_M)