summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-06-29 15:26:30 +0100
committerRichard Hughes <richard@hughsie.com>2015-06-29 15:26:30 +0100
commit915f1323121a5827c16ab76d471adfc82411584f (patch)
tree024600db8cadf4144394025f6805fe6ffff8a74f
parente0ecc3235f6382615d00124cc0a45d0dcb57b783 (diff)
downloadappstream-glib-915f1323121a5827c16ab76d471adfc82411584f.tar.gz
Don't crash when parsing a <release> with no description
Fixes https://github.com/hughsie/appstream-glib/issues/54
-rw-r--r--libappstream-glib/as-release.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c
index 48e121d..8ed4fb8 100644
--- a/libappstream-glib/as-release.c
+++ b/libappstream-glib/as-release.c
@@ -472,8 +472,12 @@ as_release_node_parse (AsRelease *release, GNode *node,
_cleanup_string_free_ GString *xml = NULL;
if (as_node_get_tag (n) != AS_TAG_DESCRIPTION)
continue;
+ if (n->children == NULL)
+ continue;
xml = as_node_to_xml (n->children,
AS_NODE_TO_XML_FLAG_INCLUDE_SIBLINGS);
+ if (xml == NULL)
+ continue;
as_release_set_description (release,
as_node_get_attribute (n, "xml:lang"),
xml->str, xml->len);