summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c
index d75de418e..9ec95c141 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -250,11 +250,10 @@ enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, stru
struct event *ev = *evp;
if (*divemode == UNDEF_COMP_TYPE) {
*divemode = dc->divemode;
- ev = dc ? dc->events : NULL;
+ ev = dc ? get_next_event(dc->events, "modechange") : NULL;
}
while (ev && ev->time.seconds < time) {
- if (ev != dc->events)
- *divemode = (enum dive_comp_type) ev->value;
+ *divemode = (enum dive_comp_type) ev->value;
ev = get_next_event(ev->next, "modechange");
}
*evp = ev;