summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2020-04-12 13:44:08 +0200
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-04-13 09:42:29 +0200
commit9feda560061fca3ade0e22101d810df9f7957a5c (patch)
tree49ae82cfc1c66975f7e61c99d799b0a74e235d37 /core
parentb50d5b63adb0c10bf4eb48d0aef8c54864cd67ae (diff)
downloadsubsurface-9feda560061fca3ade0e22101d810df9f7957a5c.tar.gz
Remove extra argument and add a test
The compiler complained about this and it seems the function does not need it. Additional-test-suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r--core/divelist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/divelist.c b/core/divelist.c
index fa8db6702..750eb42db 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -1287,7 +1287,9 @@ static struct dive *get_last_valid_dive()
*/
int get_dive_nr_at_idx(int idx)
{
- struct dive *last_dive = get_last_valid_dive(dive_table.nr - 1);
+ if (idx < dive_table.nr)
+ return 0;
+ struct dive *last_dive = get_last_valid_dive();
if (!last_dive)
return 1;
return last_dive->number ? last_dive->number + 1 : 0;