diff options
author | Willem Ferguson <willemferguson@zoology.up.ac.za> | 2018-04-08 14:37:30 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-05-14 23:47:00 +0300 |
commit | 9c24d6bef816c05992c59b45d32fcb4fe256d5a3 (patch) | |
tree | 25eae905b1bc428bd3de1bf2fbaffdf86df38987 /core/dive.c | |
parent | 718f9811b71f3fc7d131b9fd27f39b0f2082623f (diff) | |
download | subsurface-9c24d6bef816c05992c59b45d32fcb4fe256d5a3.tar.gz |
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>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index 950f4b336..d75de418e 100644 --- a/core/dive.c +++ b/core/dive.c @@ -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; |