From 725b70e64c5725005e75044e05de0cf71f3d2efa Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Wed, 11 Oct 2023 22:15:43 +0200 Subject: [PATCH] Correctly find min o2 in get_dive_gas When the import from a dive computer gives you 100% as the first gas, the get_dive_gas never finds which gas had the lowest o2 percent. This fixes the logic to find the lowest o2 percent in any dive cylinder list. Signed-off-by: Anton Lundin --- core/divelist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/divelist.c b/core/divelist.c index a92eb82e9..be7f2831a 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -47,6 +47,8 @@ void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2max_p) continue; if (o2 > maxo2) maxo2 = o2; + if (o2 < mino2) + mino2 = o2; if (he > maxhe) goto newmax; if (he < maxhe)