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>
This commit is contained in:
Dirk Hohndel 2017-11-25 08:19:47 -08:00
parent fc56b3c7b5
commit e20e1aad0e

View file

@ -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();