Avoid negative array index

This case should be impossible to hit - but this seems better than
assuming this can never happen.

Coverity CID 1325458

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-02 21:25:17 -04:00
parent ae854ff822
commit 7cfd124f67

4
dive.c
View file

@ -2906,9 +2906,9 @@ static int split_dive_at(struct dive *dive, int a, int b)
fixup_dive(d1);
fixup_dive(d2);
if ((i = get_divenr(dive)) < 0)
return 0;
i = get_divenr(dive);
delete_single_dive(i);
add_single_dive(i, d1);