From 0b7c11a597d5c10a8b8c1ed52861846ac2c2cba7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 8 Mar 2014 16:49:34 -0800 Subject: [PATCH] Another case of 'dereference before NULL check' Signed-off-by: Dirk Hohndel --- divelist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/divelist.c b/divelist.c index 229ea19c8..8bad4828d 100644 --- a/divelist.c +++ b/divelist.c @@ -793,10 +793,12 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b) { struct dive *res; int i, j; - int id = a->id; + int id; if (!a || !b) return NULL; + + id = a->id; i = get_divenr(a); j = get_divenr(b); res = merge_dives(a, b, b->when - a->when, false);