mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Cleanup: don't add invalid dive to trip
Even if there is a valid trip, we should not add a structure that isn't a dive to it. Found by Coverity. Fixes CID #350073 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
30566135aa
commit
cc2269b9c5
1 changed files with 5 additions and 4 deletions
|
@ -246,12 +246,13 @@ void dive_end(struct parser_state *state)
|
|||
{
|
||||
if (!state->cur_dive)
|
||||
return;
|
||||
if (!is_dive(state))
|
||||
if (!is_dive(state)) {
|
||||
free_dive(state->cur_dive);
|
||||
else
|
||||
} else {
|
||||
record_dive_to_table(state->cur_dive, state->target_table);
|
||||
if (state->cur_trip)
|
||||
add_dive_to_trip(state->cur_dive, state->cur_trip);
|
||||
if (state->cur_trip)
|
||||
add_dive_to_trip(state->cur_dive, state->cur_trip);
|
||||
}
|
||||
state->cur_dive = NULL;
|
||||
state->cur_dc = NULL;
|
||||
state->cur_location.lat.udeg = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue