summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-04-29 10:39:13 +0100
committerRichard Hughes <richard@hughsie.com>2016-04-29 10:39:20 +0100
commitf202867972dfda2e8ddabab74440cc92dfa21d90 (patch)
treefa9ac20f2bbcf9e9b0d7a525611e07cd9a17684f
parent5ec844a770883b624ad8ea6bc331975c7358a683 (diff)
downloadappstream-glib-f202867972dfda2e8ddabab74440cc92dfa21d90.tar.gz
Fall back to the icon name for LOCAL icon types
If we import a desktop file with Icon=gcompris and then dump it to XML we get a LOCAL icon type without having resolved a filename. You could argue this icon type could be something like THEME but this fix means we can keep things simple.
-rw-r--r--libappstream-glib/as-icon.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c
index 21f3bf5..1e6b01d 100644
--- a/libappstream-glib/as-icon.c
+++ b/libappstream-glib/as-icon.c
@@ -531,9 +531,15 @@ as_icon_node_insert (AsIcon *icon, GNode *parent, AsNodeContext *ctx)
NULL);
break;
case AS_ICON_KIND_LOCAL:
- n = as_node_insert (parent, "icon", priv->filename, 0,
- "type", as_icon_kind_to_string (priv->kind),
- NULL);
+ if (priv->filename != NULL) {
+ n = as_node_insert (parent, "icon", priv->filename, 0,
+ "type", as_icon_kind_to_string (priv->kind),
+ NULL);
+ } else {
+ n = as_node_insert (parent, "icon", priv->name, 0,
+ "type", as_icon_kind_to_string (priv->kind),
+ NULL);
+ }
break;
default:
n = as_node_insert (parent, "icon", priv->name, 0,