mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: don't crash on merge of non-existing dive site
While we shouldn't have a dive that references a dive site that doesn't exist, if we do, we shouldn't crash. And a dive site that doesn't exist is most definitely 'empty'. Reported-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7297c5991b
commit
03bc40194d
1 changed files with 2 additions and 1 deletions
|
@ -240,7 +240,8 @@ uint32_t create_dive_site_with_gps(const char *name, degrees_t latitude, degrees
|
|||
/* a uuid is always present - but if all the other fields are empty, the dive site is pointless */
|
||||
bool dive_site_is_empty(struct dive_site *ds)
|
||||
{
|
||||
return empty_string(ds->name) &&
|
||||
return !ds ||
|
||||
empty_string(ds->name) &&
|
||||
empty_string(ds->description) &&
|
||||
empty_string(ds->notes) &&
|
||||
ds->latitude.udeg == 0 &&
|
||||
|
|
Loading…
Add table
Reference in a new issue