summaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-11 12:31:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-11 12:31:00 -0700
commite9e9996766a47044249cbcb7ff7185fb04ac9882 (patch)
tree558c11cb95c00ee1346a79b40585000bb4b1b620 /statistics.c
parent0739da38c59e966855c28a26ea252316149f796b (diff)
downloadsubsurface-e9e9996766a47044249cbcb7ff7185fb04ac9882.tar.gz
Better testing if the first gas is explicit
Given that we might be adding a gas change event at t = 0 we need to check for both that and t = time_or_first_sample. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/statistics.c b/statistics.c
index 17176f714..1b2a1a6d3 100644
--- a/statistics.c
+++ b/statistics.c
@@ -306,7 +306,8 @@ bool is_cylinder_used(struct dive *dive, int idx)
for_each_dc(dive, dc) {
struct event *event = get_next_event(dc->events, "gaschange");
while (event) {
- if (dc->sample && event->time.seconds == dc->sample[0].time.seconds)
+ if (dc->sample && (event->time.seconds == 0 ||
+ (dc->samples && dc->sample[0].time.seconds == event->time.seconds)))
firstGasExplicit = true;
if (get_cylinder_index(dive, event) == idx)
return true;