summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-11-18 19:14:51 +0000
committerRichard Hughes <richard@hughsie.com>2017-01-17 10:36:20 +0000
commit995faea2501a0768a6d2c6ed7b06a45892b3b95a (patch)
treef9cb97bec6b39ab1f5b9d2155ed04944c217b41f
parent6f715d2b748cc54b01710409d5f1ceeebe5addfd (diff)
downloadappstream-glib-995faea2501a0768a6d2c6ed7b06a45892b3b95a.tar.gz
Don't export NULL tags from AppData file
If we're ignoring the non-native languages when parsing (but keeping the tree) then make sure we don't try exporting null text tags from the empty tree nodes.
-rw-r--r--libappstream-glib/as-node.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c
index 83c883f..a953e72 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -326,8 +326,10 @@ as_node_to_xml_string (GString *xml,
} else if (n->children == NULL) {
if ((flags & AS_NODE_TO_XML_FLAG_FORMAT_INDENT) > 0)
as_node_add_padding (xml, depth - depth_offset);
- attrs = as_node_get_attr_string (data);
tag_str = as_tag_data_get_name (data);
+ if (tag_str == NULL)
+ return;
+ attrs = as_node_get_attr_string (data);
if (data->cdata == NULL || data->cdata[0] == '\0') {
g_string_append_printf (xml, "<%s%s/>",
tag_str, attrs);