diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index e4c62ccd0..1e8199adf 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -241,16 +241,13 @@ void MapWidgetHelper::enterEditMode(struct dive_site *ds) return; m_editMode = true; - MapLocation *exists = m_mapLocationModel->getMapLocation(ds); - QGeoCoordinate coord; // if divesite doesn't exist in the model, add a new MapLocation. + MapLocation *exists = m_mapLocationModel->getMapLocation(ds); if (!exists) { // If the dive site doesn't have a GPS location, use the centre of the map - coord = has_location(&ds->location) ? getCoordinates(ds) - : m_map->property("center").value(); + QGeoCoordinate coord = has_location(&ds->location) ? getCoordinates(ds) + : m_map->property("center").value(); m_mapLocationModel->add(new MapLocation(ds, coord, QString(ds->name))); - } else { - coord = exists->coordinate(); } centerOnDiveSite(ds); emit editModeChanged();