mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Crash fix in add_single_dive. No writing to dive_table.dives[-1]
Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2778470b97
commit
445dbe73bf
1 changed files with 3 additions and 0 deletions
|
@ -790,6 +790,9 @@ void add_single_dive(int idx, struct dive *dive)
|
|||
dive_table.nr++;
|
||||
if (dive->selected)
|
||||
amount_selected++;
|
||||
if (idx < 0)
|
||||
// convert an idx of -1 so we do insert-at-end:
|
||||
idx = dive_table.nr - 1;
|
||||
for (i = idx; i < dive_table.nr; i++) {
|
||||
struct dive *tmp = dive_table.dives[i];
|
||||
dive_table.dives[i] = dive;
|
||||
|
|
Loading…
Add table
Reference in a new issue