summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-31 16:12:56 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-31 16:12:56 -0700
commit96cffe88e72cefa29c13dd839332b0cc7ce42ed2 (patch)
tree0ae4f34ac1bb6bbe71d2c71ade392a3ed374b5e7 /qt-ui
parentf28cec7b9eb5ad4bca007bcde9810e802e668768 (diff)
downloadsubsurface-96cffe88e72cefa29c13dd839332b0cc7ce42ed2.tar.gz
Fix crash
With no dive sites we dereference a NULL pointer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 720193a6b..2ecfb6c6d 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -219,8 +219,13 @@ MainTab::~MainTab()
void MainTab::setCurrentLocationIndex()
{
- if (current_dive)
- ui.location->setCurrentText(get_dive_site_by_uuid(current_dive->dive_site_uuid)->name);
+ if (current_dive) {
+ struct dive_site *ds = get_dive_site_by_uuid(current_dive->dive_site_uuid);
+ if (ds)
+ ui.location->setCurrentText(ds->name);
+ else
+ ui.location->setCurrentText("");
+ }
}
void MainTab::enableGeoLookupEdition()