summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/planner.c b/planner.c
index abefb6213..687da8273 100644
--- a/planner.c
+++ b/planner.c
@@ -616,7 +616,8 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
for (stopidx = 0; stopidx < sizeof(decostoplevels) / sizeof(int); stopidx++)
if (decostoplevels[stopidx] >= depth)
break;
- stopidx--;
+ if (stopidx > 0)
+ stopidx--;
/* so now we know the first decostop level above us
* NOTE, this could be the surface or a long list of potential stops