mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: avoid crash when reading corrupted git data
If a merge mishap creates inconsistent data for a dive in git storage, where the dive references a dive site that no longer exists, the app would crash when trying to open the cloud storage. I don't think a NULL dive could ever happen, but this seems fairly cheap insurance. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f7a2ad71ca
commit
3b42aada18
2 changed files with 9 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
- core: avoid crash with corrupted cloud storage
|
||||
- planner: make ESC (cancel plan) work when moving handles
|
||||
- dive list: make dive guide visible in dive list [#3382]
|
||||
- general: rename dive master to dive guide
|
||||
|
|
|
@ -371,6 +371,14 @@ void purge_empty_dive_sites(struct dive_site_table *ds_table)
|
|||
void add_dive_to_dive_site(struct dive *d, struct dive_site *ds)
|
||||
{
|
||||
int idx;
|
||||
if (!d) {
|
||||
fprintf(stderr, "Warning: add_dive_to_dive_site called with NULL dive\n");
|
||||
return;
|
||||
}
|
||||
if (!ds) {
|
||||
fprintf(stderr, "Warning: add_dive_to_dive_site called with NULL dive site\n");
|
||||
return;
|
||||
}
|
||||
if (d->dive_site == ds)
|
||||
return;
|
||||
if (d->dive_site) {
|
||||
|
|
Loading…
Add table
Reference in a new issue