summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-01-17 09:09:18 +0000
committerRichard Hughes <richard@hughsie.com>2016-01-17 09:10:04 +0000
commit2394abeb8d3d797c9180a44199e654d0de9c0e56 (patch)
tree0beae48859088990022bd22166e5dcaee4f7cd74
parent2fbd464a991cda5db10b9e9f8fd1bdd367d638ba (diff)
downloadappstream-glib-2394abeb8d3d797c9180a44199e654d0de9c0e56.tar.gz
trivial: Never write empty <screenshot/> tags
-rw-r--r--libappstream-glib/as-screenshot.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c
index 3f411f3..a574e94 100644
--- a/libappstream-glib/as-screenshot.c
+++ b/libappstream-glib/as-screenshot.c
@@ -341,7 +341,7 @@ as_screenshot_set_caption (AsScreenshot *screenshot,
*
* Inserts the screenshot into the DOM tree.
*
- * Returns: (transfer none): A populated #GNode
+ * Returns: (transfer none): A populated #GNode, or %NULL
*
* Since: 0.1.1
**/
@@ -355,6 +355,10 @@ as_screenshot_node_insert (AsScreenshot *screenshot,
GNode *n;
guint i;
+ /* nothing to add */
+ if (priv->images->len == 0)
+ return NULL;
+
n = as_node_insert (parent, "screenshot", NULL,
AS_NODE_INSERT_FLAG_NONE,
NULL);