diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 4f1241d82..b9146a178 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -567,14 +567,18 @@ void DiveLocationLineEdit::fixPopupPosition() void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d) { - struct dive_site *ds = get_dive_site_for_dive(d); - currDs = ds; + location_t currentLocation; + if (d) { + currDs = get_dive_site_for_dive(d); + currentLocation = dive_get_gps_location(d); + } else { + currDs = nullptr; + currentLocation = location_t{0, 0}; + } if (!currDs) clear(); else - setText(ds->name); - - location_t currentLocation = d ? dive_get_gps_location(d) : location_t{0, 0}; + setText(currDs->name); proxy->setCurrentLocation(currentLocation); delegate.setCurrentLocation(currentLocation); } |