Fix SIGSEGV when joining dives without dive computer information

Handle the case where we have no divecomputer information.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2012-12-06 10:30:36 -08:00 committed by Dirk Hohndel
parent d5da3c9a95
commit 5ac5408bb0

2
dive.c
View file

@ -1292,7 +1292,7 @@ static void interleave_dive_computers(struct divecomputer *res,
do {
struct divecomputer *match;
res->model = strdup(a->model);
res->model = a->model ? strdup(a->model) : NULL;
res->deviceid = a->deviceid;
res->diveid = a->diveid;
res->next = NULL;