mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't access invalid elements with depth = 0
This is a corner case in the planner that was exposed by the recent changes to the way the dive plan reflects the gases during the dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8941e8677e
commit
edecb0fcf9
1 changed files with 2 additions and 1 deletions
|
@ -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++)
|
for (stopidx = 0; stopidx < sizeof(decostoplevels) / sizeof(int); stopidx++)
|
||||||
if (decostoplevels[stopidx] >= depth)
|
if (decostoplevels[stopidx] >= depth)
|
||||||
break;
|
break;
|
||||||
stopidx--;
|
if (stopidx > 0)
|
||||||
|
stopidx--;
|
||||||
|
|
||||||
/* so now we know the first decostop level above us
|
/* so now we know the first decostop level above us
|
||||||
* NOTE, this could be the surface or a long list of potential stops
|
* NOTE, this could be the surface or a long list of potential stops
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue