summaryrefslogtreecommitdiffstats
path: root/core/parse.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-17 10:26:43 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-11-18 16:50:09 -0800
commit0fc58f45345f9d33a896a284cba5420ed4f4b1bc (patch)
tree64b8ea2002490bf93a266c8bc905ea576b6fa881 /core/parse.c
parent911edfca712a046944de6d033cc4b8dd50cedfc3 (diff)
downloadsubsurface-0fc58f45345f9d33a896a284cba5420ed4f4b1bc.tar.gz
Parser: add dive to trip at end of dive-parsing
When adding the dive to its trip before having filled out "when", the dive gets added at the first position (when=0), which is usually not correct. Instead, add the dive to its trip when all fields are correctly filled out. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse.c')
-rw-r--r--core/parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/parse.c b/core/parse.c
index f54d36742..6f12736a8 100644
--- a/core/parse.c
+++ b/core/parse.c
@@ -243,10 +243,6 @@ void dive_start(struct parser_state *state)
state->cur_dive = alloc_dive();
reset_dc_info(&state->cur_dive->dc, state);
memset(&state->cur_tm, 0, sizeof(state->cur_tm));
- if (state->cur_trip) {
- add_dive_to_trip(state->cur_dive, state->cur_trip);
- state->cur_dive->tripflag = IN_TRIP;
- }
state->o2pressure_sensor = 1;
}
@@ -258,6 +254,10 @@ void dive_end(struct parser_state *state)
free_dive(state->cur_dive);
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);
+ state->cur_dive->tripflag = IN_TRIP;
+ }
state->cur_dive = NULL;
state->cur_dc = NULL;
state->cur_location.lat.udeg = 0;