diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-09-20 06:39:54 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-20 08:47:08 -0700 |
commit | 076d8966f075e717a640cedfdf178503072d4da0 (patch) | |
tree | 414ed4bd50127b799f0f19a5c073086ac87531d9 /core | |
parent | 13dbbd3085cf450f50aa28473571de572eeba26b (diff) | |
download | subsurface-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.c | 4 |
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; } |