summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-11-18 19:14:51 +0000
committerRichard Hughes <richard@hughsie.com>2016-11-18 19:16:08 +0000
commitc871fb69c1bd8e3a38562d898f619d673da90d77 (patch)
tree1d01f97b49566056e643583a1f04d411865b79d5
parent538da2d8e078de3ec7f38b56e4ddadd1da401c4d (diff)
downloadappstream-glib-c871fb69c1bd8e3a38562d898f619d673da90d77.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 39803af..39cba47 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -434,8 +434,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);