Uemis Patch 0010

Guido Lerch guido.lerch at gmail.com
Thu Sep 10 11:57:00 PDT 2015


fixeds a bug in uemis_set_location whereas I had cases where DS was NULL

-- 
Best regards,
Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150910/a33858c3/attachment-0001.html>
-------------- next part --------------
From 4274b51be390e6bcfc1811313d16ef21a52e153a Mon Sep 17 00:00:00 2001
From: glerch <guido.lerch at gmail.com>
Date: Thu, 10 Sep 2015 20:54:03 +0200
Subject: [PATCH 10/10] Uemis - 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 <guido.lerch at gmail.com>
---
 uemis.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/uemis.c b/uemis.c
index 0e55a8e..9b39b54 100644
--- a/uemis.c
+++ b/uemis.c
@@ -175,9 +175,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;
 	}
-- 
1.9.5 (Apple Git-50.3)



More information about the subsurface mailing list