summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 06:39:54 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 08:47:08 -0700
commit076d8966f075e717a640cedfdf178503072d4da0 (patch)
tree414ed4bd50127b799f0f19a5c073086ac87531d9 /core
parent13dbbd3085cf450f50aa28473571de572eeba26b (diff)
downloadsubsurface-076d8966f075e717a640cedfdf178503072d4da0.tar.gz
Prevent possible NULL pointer dereference
Not sure if this will fix the crash for Henrik, but it's worth a try. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/libdivecomputer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index f76a654d4..7eea60393 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -498,9 +498,9 @@ static void dc_match_serial(void *_dc, const char *model, uint32_t deviceid, con
if (!deviceid)
return;
- if (!model || strcasecmp(dc->model, model))
+ if (!dc->model && (!model || strcasecmp(dc->model, model)))
return;
- if (!serial || strcasecmp(dc->serial, serial))
+ if (!dc->serial || !serial || strcasecmp(dc->serial, serial))
return;
dc->deviceid = deviceid;
}