[gimp] Guard against g_file_info_get_icon() returning NULL
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Guard against g_file_info_get_icon() returning NULL
- Date: Tue, 22 Sep 2009 18:26:41 +0000 (UTC)
commit 295f345b2eca4b224f51192632e0bc2060c6e07d
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.
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 5aec63a..c2bdb6a 100644
--- a/app/widgets/gimpviewrendererimagefile.c
+++ b/app/widgets/gimpviewrendererimagefile.c
@@ -165,9 +165,8 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
if (! pixbuf)
{
- GFile *file;
- GFileInfo *file_info;
- GtkIconInfo *info;
+ GFile *file;
+ GFileInfo *file_info;
file = g_file_new_for_uri (gimp_object_get_name (imagefile));
file_info = g_file_query_info (file, "standard::icon", 0, NULL, NULL);
@@ -176,8 +175,19 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
{
GIcon *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]