Make sure the model is non-NULL before comparing with it

In commit 194a05b18911 "Correct the detection of existing dives in the
Uemis downloader" I forgot to add that check before calling strcmp.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-12-29 11:28:35 -08:00
parent e862f7c343
commit 7aaa539afe

View file

@ -733,7 +733,7 @@ static char *get_divenr(char *deviceidstr)
for (i = 0; i < dive_table.nr; i++) {
struct divecomputer *dc = &dive_table.dives[i]->dc;
while (dc) {
if (!strcmp(dc->model, "Uemis Zurich") &&
if (dc->model && !strcmp(dc->model, "Uemis Zurich") &&
dc->deviceid == deviceid && dc->diveid > maxdiveid)
maxdiveid = dc->diveid;
dc = dc->next;