diff options
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index 915a04fe5..ecddda6b9 100644 --- a/core/dive.c +++ b/core/dive.c @@ -159,8 +159,12 @@ void add_extra_data(struct divecomputer *dc, const char *key, const char *value) struct gasmix *get_gasmix_from_event(struct dive *dive, struct event *ev) { static struct gasmix dummy; - if (ev && event_is_gaschange(ev)) + if (ev && event_is_gaschange(ev)) { + int index = ev->gas.index; + if (index >= 0 && index <= MAX_CYLINDERS) + return &dive->cylinder[index].gasmix; return &ev->gas.mix; + } return &dummy; } |