diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-11-25 08:19:47 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-11-25 08:19:47 -0800 |
commit | e20e1aad0e88fab376ab5423bf03e721f2a76940 (patch) | |
tree | d25a719311056584aef7f4881aec717f63a1dfb2 /core/subsurface-qt/DiveObjectHelper.cpp | |
parent | fc56b3c7b59cc49ad450a14bc332f4a802a923ff (diff) | |
download | subsurface-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.cpp | 9 |
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(); |