summaryrefslogtreecommitdiff
path: root/libappstream-glib
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-05-22 09:22:14 +0100
committerRichard Hughes <richard@hughsie.com>2014-05-22 09:22:14 +0100
commitec594f5ddd47b4472cb2aadcc9754552a87efc0c (patch)
tree19337bc3b7c50aa6e84e046c6506e8127ffc9739 /libappstream-glib
parent25bf6434dbbeb7280e86d6a9a19c8aaf1166c797 (diff)
downloadappstream-glib-ec594f5ddd47b4472cb2aadcc9754552a87efc0c.tar.gz
Fix validation of old-style AppData files without screenshot sizes
Diffstat (limited to 'libappstream-glib')
-rw-r--r--libappstream-glib/as-screenshot.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c
index 2389ecf..a90e554 100644
--- a/libappstream-glib/as-screenshot.c
+++ b/libappstream-glib/as-screenshot.c
@@ -325,6 +325,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error)
GNode *c;
const gchar *tmp;
gboolean ret = TRUE;
+ guint size;
tmp = as_node_get_attribute (node, "type");
if (tmp != NULL) {
@@ -351,10 +352,12 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error)
if (tmp != NULL) {
image = as_image_new ();
as_image_set_kind (image, AS_IMAGE_KIND_SOURCE);
- as_image_set_width (image,
- as_node_get_attribute_as_int (node, "width"));
- as_image_set_height (image,
- as_node_get_attribute_as_int (node, "height"));
+ size = as_node_get_attribute_as_int (node, "width");
+ if (size != G_MAXUINT)
+ as_image_set_width (image, size);
+ size = as_node_get_attribute_as_int (node, "height");
+ if (size != G_MAXUINT)
+ as_image_set_height (image, size);
as_image_set_url (image, tmp, -1);
g_ptr_array_add (priv->images, image);
}