[gimp/gimp-2-6] Guard against g_file_info_get_icon() returning NULL
- From: Sven Neumann <neo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-6] Guard against g_file_info_get_icon() returning NULL
- Date: Mon, 18 Oct 2010 15:50:46 +0000 (UTC)
commit d72a318a2c582a6b17e9327a5c1d72167b0b2d91
Author: Michael Natterer <mitch gimp org>
Date: Tue Sep 22 20:25:11 2009 +0200
Guard against g_file_info_get_icon() returning NULL
It can return NULL, but should not for a proper gvfs backend; add a
returning NULL.
(cherry picked from commit 295f345b2eca4b224f51192632e0bc2060c6e07d)
app/widgets/gimpviewrendererimagefile.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/app/widgets/gimpviewrendererimagefile.c b/app/widgets/gimpviewrendererimagefile.c
index 8d2a893..ca84911 100644
--- a/app/widgets/gimpviewrendererimagefile.c
+++ b/app/widgets/gimpviewrendererimagefile.c
@@ -167,9 +167,8 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
#if GTK_CHECK_VERSION (2, 13, 4)
if (! pixbuf)
{
- GFile *file;
- GFileInfo *file_info;
- GtkIconInfo *info;
+ GFile *file;
+ GFileInfo *file_info;
file = g_file_new_for_uri (gimp_object_get_name (GIMP_OBJECT (imagefile)));
file_info = g_file_query_info (file, "standard::icon", 0, NULL, NULL);
@@ -180,8 +179,19 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
icon = g_file_info_get_icon (file_info);
- info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, 0);
- pixbuf = gtk_icon_info_load_icon (info, NULL);
+ if (icon)
+ {
+ GtkIconInfo *info;
+
+ info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, 0);
+ pixbuf = gtk_icon_info_load_icon (info, NULL);
+ }
+ else
+ {
+#ifdef GIMP_UNSTABLE
+ g_printerr ("no icon for: %s\n", gimp_object_get_name (imagefile));
+#endif
+ }
g_object_unref (file_info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]