mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: fix crash concerning removal of dives from trips
Commit 6b283e598a
replaced the linked
list of dives in a trip by a table. Embarassingly, on dive deletion
the index of the dive in the table was compared for "!= 0" instead
of ">= 0". Thus, the first dive of a trip wouldn't be deleted, which
ultimately led to a crash, as different parts of the code were now
in disagreement over whether the trip is empty or not.
Fix the comparison.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5d8830750a
commit
01d031383c
1 changed files with 1 additions and 1 deletions
|
@ -872,7 +872,7 @@ struct dive_trip *unregister_dive_from_trip(struct dive *dive, short was_autogen
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
idx = get_idx_in_table(&trip->dives, dive);
|
idx = get_idx_in_table(&trip->dives, dive);
|
||||||
if (idx)
|
if (idx >= 0)
|
||||||
unregister_dive_from_table(&trip->dives, idx);
|
unregister_dive_from_table(&trip->dives, idx);
|
||||||
dive->divetrip = NULL;
|
dive->divetrip = NULL;
|
||||||
return trip;
|
return trip;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue