gases: fill result of isobaric_counterdiffusion() on early return

If prefs.show_icd is false, this function does nothing, but
the output parameter is checked by the calling function
DiveEventItem::setupToolTipString().

Let's reset the strucvture to 0.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-16 22:23:15 +01:00 committed by Dirk Hohndel
parent 4bab38b8df
commit 13b894a756

View file

@ -15,8 +15,10 @@
*/
bool isobaric_counterdiffusion(struct gasmix oldgasmix, struct gasmix newgasmix, struct icd_data *results)
{
if (!prefs.show_icd)
if (!prefs.show_icd) {
results->dN2 = results->dHe = 0;
return false;
}
results->dN2 = get_n2(newgasmix) - get_n2(oldgasmix);
results->dHe = get_he(newgasmix) - get_he(oldgasmix);
return get_he(oldgasmix) > 0 && results->dN2 > 0 && results->dHe < 0 && get_he(oldgasmix) && results->dN2 > 0 && 5 * results->dN2 > -results->dHe;