From 682e23775c93a00804f71131342ee52aeacc6337 Mon Sep 17 00:00:00 2001 From: glerch Date: Thu, 10 Sep 2015 20:54:03 +0200 Subject: Uemis downloader: bug fix in uemis set dive location Assuring that ds isn't NULL, had a few cases that made SubSurface crash. Have not investigated the root cause but it's likely that it is related to the Uemis specific code. Nevertheless, checking ds non NULL is certainly not a bad thing to do. Signed-off-by: glerch Signed-off-by: Dirk Hohndel --- uemis.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'uemis.c') diff --git a/uemis.c b/uemis.c index 1c592832a..352c9a028 100644 --- a/uemis.c +++ b/uemis.c @@ -173,9 +173,11 @@ void uemis_set_divelocation(int divespot, char *text, double longitude, double l while (hp) { if (hp->divespot == divespot) { struct dive_site *ds = get_dive_site_by_uuid(hp->dive_site_uuid); - ds->name = strdup(text); - ds->longitude.udeg = round(longitude * 1000000); - ds->latitude.udeg = round(latitude * 1000000); + if (ds) { + ds->name = strdup(text); + ds->longitude.udeg = round(longitude * 1000000); + ds->latitude.udeg = round(latitude * 1000000); + } } hp = hp->next; } -- cgit v1.2.3-70-g09d2