diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-02 21:25:17 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-02 21:25:17 -0400 |
commit | 7cfd124f6704137d4c37d2318d33cef753a858e4 (patch) | |
tree | 627508de806f9a96b15a3501b348d1489ce8b28e | |
parent | ae854ff82277c632fc3e10683780ab64d1a36cb2 (diff) | |
download | subsurface-7cfd124f6704137d4c37d2318d33cef753a858e4.tar.gz |
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>
-rw-r--r-- | dive.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |