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>
This commit is contained in:
Robert C. Helling 2020-04-12 13:44:08 +02:00 committed by bstoeger
parent b50d5b63ad
commit 9feda56006

View file

@ -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;