[gnome-software] Do not crash if a desktop file does not have an icon
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not crash if a desktop file does not have an icon
- Date: Wed, 28 Aug 2013 11:42:04 +0000 (UTC)
commit dbdad217360e5490546b823338b8beb28eabff0c
Author: Richard Hughes <richard hughsie com>
Date: Wed Aug 28 12:32:58 2013 +0100
Do not crash if a desktop file does not have an icon
src/plugins/gs-plugin-datadir-apps.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index c4eb1d5..0829f06 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -169,18 +169,20 @@ gs_plugin_datadir_apps_extract_desktop_data (GsPlugin *plugin,
NULL);
/* set pixbuf */
- if (icon[0] == '/') {
- pixbuf = gdk_pixbuf_new_from_file_at_size (icon,
- plugin->pixbuf_size,
+ if (icon != NULL) {
+ if (icon[0] == '/') {
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon,
+ plugin->pixbuf_size,
+ plugin->pixbuf_size,
+ NULL);
+ } else {
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ icon,
plugin->pixbuf_size,
+ GTK_ICON_LOOKUP_USE_BUILTIN |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
- } else {
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- icon,
- plugin->pixbuf_size,
- GTK_ICON_LOOKUP_USE_BUILTIN |
- GTK_ICON_LOOKUP_FORCE_SIZE,
- NULL);
+ }
}
if (pixbuf != NULL)
cache_item->pixbuf = g_object_ref (pixbuf);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]