Fix bug for CCR dive bailout

Under some conditions get_current_divemode() (in dive.c) returns an
erroneous divemode. This happens when there are several events at
the very beginning of the dive, as can happen in some CCR dive logs.
This commit fixes that bug.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
Willem Ferguson 2018-04-08 14:37:30 +02:00 committed by Lubomir I. Ivanov
parent 718f9811b7
commit 9c24d6bef8

View file

@ -253,7 +253,8 @@ enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, stru
ev = dc ? dc->events : NULL;
}
while (ev && ev->time.seconds < time) {
*divemode = (enum dive_comp_type) ev->value;
if (ev != dc->events)
*divemode = (enum dive_comp_type) ev->value;
ev = get_next_event(ev->next, "modechange");
}
*evp = ev;