From 065559c3d8194ee8ac2a251091eddb5da803d105 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 13 Nov 2019 10:08:28 +0100 Subject: Core: set gas use to zero if no values are given In get_gas_used() the use was left uninitialized if there are neither user- nor computer-supplied values. This gives random SACs in the UI. Initialize to 0. Fixes #2376. Reported-by: Stefan Fuchs Signed-off-by: Berthold Stoeger --- core/statistics.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core') diff --git a/core/statistics.c b/core/statistics.c index 7adffa2f0..a83878300 100644 --- a/core/statistics.c +++ b/core/statistics.c @@ -376,6 +376,8 @@ volume_t *get_gas_used(struct dive *dive) end = cyl->end.mbar ? cyl->end : cyl->sample_end; if (end.mbar && start.mbar > end.mbar) gases[idx].mliter = gas_volume(cyl, start) - gas_volume(cyl, end); + else + gases[idx].mliter = 0; } return gases; -- cgit v1.2.3-70-g09d2