aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 09:10:02 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 09:26:35 -0700
commitc809a8873cd7e0a9df80d18a6273b227ae2177b4 (patch)
treeeb70aace582b8f79f5ac10f11114601f0c328961 /core
parent92caf2771b07ed721afa41afea08af1f7ae3f3a1 (diff)
downloadsubsurface-c809a8873cd7e0a9df80d18a6273b227ae2177b4.tar.gz
Second attempt to fix crash
Linus pointed out that it might be another call site (and looking at his proposed patch I noticed a logic error in my earlier attempt) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/device.c2
-rw-r--r--core/libdivecomputer.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/device.c b/core/device.c
index dde758dc8..86c30dbd9 100644
--- a/core/device.c
+++ b/core/device.c
@@ -193,7 +193,7 @@ static void match_id(void *_dc, const char *model, uint32_t deviceid,
if (dc->deviceid != deviceid)
return;
- if (strcmp(dc->model, model))
+ if (!model || !dc->model || strcmp(dc->model, model))
return;
if (serial && !dc->serial)
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 7eea60393..25abc4d23 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -498,7 +498,7 @@ static void dc_match_serial(void *_dc, const char *model, uint32_t deviceid, con
if (!deviceid)
return;
- if (!dc->model && (!model || strcasecmp(dc->model, model)))
+ if (!dc->model || !model || strcasecmp(dc->model, model))
return;
if (!dc->serial || !serial || strcasecmp(dc->serial, serial))
return;