aboutsummaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-15 15:16:39 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-15 12:50:44 -0400
commit2775e7e9910ec76f47f7568f02a06c84c01265fa (patch)
tree3cc210f01b62d5e109e550edd63b1ca6e8e183e1 /core/divelist.c
parent207ca0f94e96fa9f903653295a5cac4691a8b45a (diff)
downloadsubsurface-2775e7e9910ec76f47f7568f02a06c84c01265fa.tar.gz
Dive import: remove dive-to-be added from trip before deletion
On dive import, dives to be added may be merged into already existing dives. In such a case, the dive to be added is deleted. Before doing so, it must be removed from the trip is belongs to to avoid corruption of the trip-list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r--core/divelist.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/divelist.c b/core/divelist.c
index 65c3298c8..922c04e43 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -1507,6 +1507,7 @@ static bool try_to_merge_into(struct dive *dive_to_add, int idx, bool prefer_imp
add_dive_to_trip(merged, trip);
}
free_dive(old_dive);
+ remove_dive_from_trip(dive_to_add, false);
free_dive(dive_to_add);
return true;