aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dive.c b/dive.c
index 5bcdf3aa8..73c7bd2e7 100644
--- a/dive.c
+++ b/dive.c
@@ -789,7 +789,7 @@ static int same_rounded_pressure(pressure_t a, pressure_t b)
int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc)
{
struct event *ev = get_next_event(dc->events, "gaschange");
- if (ev && ev->time.seconds == dc->sample[0].time.seconds)
+ if (ev && dc && dc->sample && ev->time.seconds == dc->sample[0].time.seconds)
return get_cylinder_index(dive, ev);
else
return 0;