mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
Don't access undefined dive
When walking the dive table we need to stop before accessing the yet-to-be-added new dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bf798390fa
commit
01ae4af13d
1 changed files with 1 additions and 1 deletions
|
@ -794,7 +794,7 @@ void add_single_dive(int idx, struct dive *dive)
|
|||
if (idx < 0) {
|
||||
// convert an idx of -1 so we do insert-in-chronological-order
|
||||
idx = dive_table.nr - 1;
|
||||
for (int i = 0; i < dive_table.nr; i++) {
|
||||
for (int i = 0; i < dive_table.nr - 1; i++) {
|
||||
if (dive->when <= dive_table.dives[i]->when) {
|
||||
idx = i;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue