summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--divelist.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c
index 3cc0d2c8d..86117422f 100644
--- a/divelist.c
+++ b/divelist.c
@@ -833,6 +833,9 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b)
id = a->id;
i = get_divenr(a);
j = get_divenr(b);
+ if (i < 0 || j < 0)
+ // something is wrong with those dives. Bail
+ return NULL;
res = merge_dives(a, b, b->when - a->when, false);
if (!res)
return NULL;