From 9feda560061fca3ade0e22101d810df9f7957a5c Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 12 Apr 2020 13:44:08 +0200 Subject: 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 Signed-off-by: Robert C. Helling --- core/divelist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-70-g09d2