From 13b894a75606ac94a830dd4b0981f4755916a9a6 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 16 Jan 2024 22:23:15 +0100 Subject: [PATCH] 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 --- core/gas.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/gas.c b/core/gas.c index 175e1a7d8..96dc60479 100644 --- a/core/gas.c +++ b/core/gas.c @@ -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;