From e20e1aad0e88fab376ab5423bf03e721f2a76940 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 25 Nov 2017 08:19:47 -0800 Subject: 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 --- core/subsurface-qt/DiveObjectHelper.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core') 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(); -- cgit v1.2.3-70-g09d2