summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-06-26 15:03:34 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 18:50:22 -0700
commit05c5bf0919d57102d5509b58cce0b9e6c527aa6c (patch)
treefbdf79ca7b6f2ad81a15452f2855ce0dec3b13f0 /qt-ui/maintab.cpp
parent2fec1a88de2a075fd9586f5fb5c57b5bab2a74a6 (diff)
downloadsubsurface-05c5bf0919d57102d5509b58cce0b9e6c527aa6c.tar.gz
Dive site rewrite: try to fix a crash
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.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 9c8cac2bf..c2eac0628 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -492,10 +492,15 @@ void MainTab::updateDiveInfo(bool clear)
if (!clear) {
struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
- if (ds)
+ if (ds) {
ui.location->setText(ds->name);
- else
+ ui.locationTags->setText(ds->description); // TODO: This should be three tags following davide's explanation.
+ copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
+ } else {
ui.location->clear();
+ clear_dive_site(&displayed_dive_site);
+ }
+
// Subsurface always uses "local time" as in "whatever was the local time at the location"
// so all time stamps have no time zone information and are in UTC
QDateTime localTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
@@ -698,13 +703,10 @@ void MainTab::updateDiveInfo(bool clear)
gasUsedString.append(QString("O2: %2\n").arg(get_volume_string(o2_tot, true)));
}
ui.gasConsumption->setText(gasUsedString);
- ui.locationTags->setText(ds->description); // TODO: This should be three tags following davide's explanation.
if(ui.locationTags->text().isEmpty())
ui.locationTags->hide();
else
ui.locationTags->show();
- copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
-
} else {
/* clear the fields */
clearInfo();