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>
This commit is contained in:
Berthold Stoeger 2018-10-15 15:16:39 +02:00 committed by Dirk Hohndel
parent 207ca0f94e
commit 2775e7e991

View file

@ -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;