From ebd6d4fc45f32527b6d8d45cd670453d925546dc Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 12 Oct 2018 09:25:00 +0200 Subject: Dive site: use displayed_dive in MainTab::refreshDisplayedDiveSite MainTab::refreshDisplayedDiveSite() was used after dive-site edit to update the information of the location entry box. This should always display the dive-site of the currently shown/edited dive, therefore it makes no sense to use the displayed_dive_site here. Simply use the dive site of displayed_dive. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/maintab.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 1a024686b..a4b9a55ff 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -656,9 +656,10 @@ MainTab::EditMode MainTab::getEditMode() const void MainTab::refreshDisplayedDiveSite() { - if (displayed_dive_site.uuid) { - copy_dive_site(get_dive_site_by_uuid(displayed_dive_site.uuid), &displayed_dive_site); - ui.location->setCurrentDiveSiteUuid(displayed_dive_site.uuid); + struct dive_site *ds = get_dive_site_for_dive(&displayed_dive); + if (ds) { + copy_dive_site(ds, &displayed_dive_site); + ui.location->setCurrentDiveSiteUuid(ds->uuid); } } -- cgit v1.2.3-70-g09d2