From a524c01c3ff571641172a3bc393bb425dd15bc53 Mon Sep 17 00:00:00 2001 From: Jan Darowski Date: Mon, 15 Jun 2015 00:25:43 +0200 Subject: [PATCH] Don't compare signed and unsigned values This fixes a "reproducable hang when using "edit dive in planner" on non-planned dive". Comparing unsigned and signed integers isn't a great idea. Fixes #880 Signed-off-by: Jan Darowski Signed-off-by: Dirk Hohndel --- planner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner.c b/planner.c index ad855e619..c8578c320 100644 --- a/planner.c +++ b/planner.c @@ -1028,7 +1028,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool TIMESTEP, po2, &displayed_dive, prefs.decosac); clock += TIMESTEP; depth -= deltad; - } while (depth > stoplevels[stopidx]); + } while (depth > 0 && depth > stoplevels[stopidx]); if (depth <= 0) break; /* We are at the surface */