diff --git a/divelist.c b/divelist.c index 0cf4d7be0..68274eafe 100644 --- a/divelist.c +++ b/divelist.c @@ -858,7 +858,7 @@ double init_decompression(struct dive *dive) ; when = dive->when; i = divenr; - while (--i) { + while (i && --i) { struct dive* pdive = get_dive(i); /* we don't want to mix dives from different trips as we keep looking * for how far back we need to go */