summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-13 10:08:28 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2019-11-16 09:23:39 +0100
commit065559c3d8194ee8ac2a251091eddb5da803d105 (patch)
treef0b9d9d9fbd548f450dad116cb79f95051f0b0cd
parent2f77716e8f9bef3f9ef26dfdcb99f17e681c4c6f (diff)
downloadsubsurface-065559c3d8194ee8ac2a251091eddb5da803d105.tar.gz
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 <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/statistics.c2
1 files changed, 2 insertions, 0 deletions
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;