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>
This commit is contained in:
Berthold Stoeger 2019-11-13 10:08:28 +01:00 committed by bstoeger
parent 2f77716e8f
commit 065559c3d8

View file

@ -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;