diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2018-10-31 11:22:52 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-31 14:51:31 +0000 |
commit | 26f6d95305acdb86c99e11c017987497d0238321 (patch) | |
tree | fa9bd01663449a8576c684248acbdd04b505ecf3 /core/save-git.c | |
parent | 68d7e7c4e386f8dfe2068cf8075aeef8f3dff367 (diff) | |
download | subsurface-26f6d95305acdb86c99e11c017987497d0238321.tar.gz |
Core: Do not crash on save dives with no dive site (git storage)
And fix a crash very similar to the previous commit. When trying to
save (to git) with an empty dive site, ssrf crashes.
Again, add a simple guard to prevent this.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core/save-git.c')
-rw-r--r-- | core/save-git.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/save-git.c b/core/save-git.c index 413c66211..422201324 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -431,7 +431,8 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b) SAVE("visibility", visibility); cond_put_format(dive->tripflag == NO_TRIP, b, "notrip\n"); save_tags(b, dive->tag_list); - cond_put_format(!!dive->dive_site, b, "divesiteid %08x\n", dive->dive_site->uuid); + if (dive->dive_site) + put_format(b, "divesiteid %08x\n", dive->dive_site->uuid); if (verbose && dive->dive_site) fprintf(stderr, "removed reference to non-existant dive site with uuid %08x\n", dive->dive_site->uuid); save_overview(b, dive); |