From 076d8966f075e717a640cedfdf178503072d4da0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 20 Sep 2016 06:39:54 -0700 Subject: 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 --- core/libdivecomputer.c | 4 ++-- 1 file 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; } -- cgit v1.2.3-70-g09d2