From d75f7474c781ee2d3b4f8c39bf296c47484d2f05 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 27 Apr 2018 20:12:02 +0200 Subject: [PATCH] When looking for gas change events only use those This function looks for the last gas change before a given time. We should initialize it with a gaschange event as we might later use this event to read a gasmix from it. Signed-off-by: Robert C. Helling --- core/dive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dive.h b/core/dive.h index acbb6eb27..795203545 100644 --- a/core/dive.h +++ b/core/dive.h @@ -960,7 +960,7 @@ static inline struct gasmix *get_gasmix(struct dive *dive, struct divecomputer * if (!gasmix) { int cyl = explicit_first_cylinder(dive, dc); gasmix = &dive->cylinder[cyl].gasmix; - ev = dc ? dc->events : NULL; + ev = dc ? get_next_event(dc->events, "gaschange") : NULL; } while (ev && ev->time.seconds < time) { gasmix = get_gasmix_from_event(dive, ev);