summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-23 17:05:31 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:15:50 -0700
commit7426f18a960b7c397842f45a5e0ca72942d04c36 (patch)
tree8e016659f464f9b05b3836a946e0bd81c7ba342a /qt-ui/maintab.cpp
parentffae64ded727f3d70c1a58c2d587531c3eb4a2f0 (diff)
downloadsubsurface-7426f18a960b7c397842f45a5e0ca72942d04c36.tar.gz
Handles Dive Selection gracefully
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c74ef527e..884ef547d 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -868,13 +868,19 @@ void MainTab::updateDiveSite(int divenr)
uint32_t pickedUuid = ui.location->currDiveSiteUuid();
const uint32_t origUuid = cd->dive_site_uuid;
struct dive_site *origDs = get_dive_site_by_uuid(origUuid);
+ struct dive_site *newDs = NULL;
+
+ if (pickedUuid == origUuid) {
+ return;
+ }
if (pickedUuid == RECENTLY_ADDED_DIVESITE) {
pickedUuid = create_dive_site(ui.location->text().isEmpty() ? qPrintable(tr("New dive site")) : qPrintable(ui.location->text()), displayed_dive.when);
- struct dive_site *newDs = get_dive_site_by_uuid(pickedUuid);
- copy_dive_site(newDs, &displayed_dive_site);
}
+ newDs = get_dive_site_by_uuid(pickedUuid);
+ copy_dive_site(newDs, &displayed_dive_site);
+
if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) {
// this is a special case - let's remove the original dive site if this was the only user
if (!is_dive_site_used(origDs->uuid, false)) {