aboutsummaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-08 16:49:34 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-08 16:49:34 -0800
commit0b7c11a597d5c10a8b8c1ed52861846ac2c2cba7 (patch)
treeff88d3f659533a610e9b39db2130040d99f5ca4f /divelist.c
parent9ee0bfe63375a89f8c4e3a9a9e8c1a4476b38e2e (diff)
downloadsubsurface-0b7c11a597d5c10a8b8c1ed52861846ac2c2cba7.tar.gz
Another case of 'dereference before NULL check'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c4
1 files changed, 3 insertions, 1 deletions
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);