[PATCH 3/3] Qt turns edited locations into null-strings

Anton Lundin glance at acc.umu.se
Tue May 6 15:27:51 PDT 2014


They aren't null pointers after you touched them, so we can't rely on
that to choose if we should use put_string or show_utf8.
show_utf8 would not print the tag if it only contains a \0 as body.

Fixes #440

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 save-xml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/save-xml.c b/save-xml.c
index 227b952..dc13fa2 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -190,7 +190,7 @@ static void show_location(struct membuffer *b, struct dive *dive)
 		int len = sprintf(buffer, "  <location ");
 
 		len += format_location(buffer + len, latitude, longitude);
-		if (!dive->location) {
+		if (!dive->location || dive->location[0] == '\0') {
 			memcpy(buffer + len, "/>\n\0", 5);
 			put_string(b, buffer);
 			return;
-- 
1.9.1



More information about the subsurface mailing list