aboutsummaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt/DiveObjectHelper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-11-25 08:19:47 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-11-25 08:19:47 -0800
commite20e1aad0e88fab376ab5423bf03e721f2a76940 (patch)
treed25a719311056584aef7f4881aec717f63a1dfb2 /core/subsurface-qt/DiveObjectHelper.cpp
parentfc56b3c7b59cc49ad450a14bc332f4a802a923ff (diff)
downloadsubsurface-e20e1aad0e88fab376ab5423bf03e721f2a76940.tar.gz
Fix crash when dives have no dive site
get_dive_site_by_uuid() returns a NULL pointer in that case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index 7a3767409..8ea8b6370 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -433,10 +433,11 @@ QStringList DiveObjectHelper::locationList() const
struct dive_site *ds;
int i = 0;
for_each_dive (i, d) {
- ds = get_dive_site_by_uuid(d->dive_site_uuid);
- QString temp = ds->name;
- if (!temp.isEmpty())
- locations << temp;
+ if ((ds = get_dive_site_by_uuid(d->dive_site_uuid)) != NULL) {
+ QString temp = ds->name;
+ if (!temp.isEmpty())
+ locations << temp;
+ }
}
locations.removeDuplicates();
locations.sort();