[PATCH 2/3] parse-xml: use the right dc for filling in extra data

Linus Torvalds torvalds at linux-foundation.org
Sat Jul 22 08:51:52 PDT 2017


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sat, 22 Jul 2017 08:32:51 -0700
Subject: [PATCH 2/3] parse-xml: use the right dc for filling in extra data

"cur_dc" may be NULL when the XML source isn't a subsurface XML file,
and xml parsing is supposed to use "get_dc()" to pick a dive computer
when the nesting of the XML may not be proper.

Now, XML sources that don't have the proper dive computer nesting
markers generally also do not end up having the extra-data string
information, but one example of this is the simple XML that the
libdivecomputer 'dctool' program generates.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 core/parse-xml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/parse-xml.c b/core/parse-xml.c
index c56a96dd..f3c2e0de 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -401,7 +401,7 @@ static void extra_data_end(void)
 {
 	// don't save partial structures - we must have both key and value
 	if (cur_extra_data.key && cur_extra_data.value)
-		add_extra_data(cur_dc, cur_extra_data.key, cur_extra_data.value);
+		add_extra_data(get_dc(), cur_extra_data.key, cur_extra_data.value);
 }
 
 static void weight(char *buffer, weight_t *weight)
-- 
2.13.1.518.g0d864c4df



More information about the subsurface mailing list