From f202867972dfda2e8ddabab74440cc92dfa21d90 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 29 Apr 2016 10:39:13 +0100 Subject: 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. --- libappstream-glib/as-icon.c | 12 +++++++++--- 1 file 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, -- cgit v1.2.1