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.
This commit is contained in:
Michael Natterer 2009-09-22 20:25:11 +02:00
parent cd7abf24b5
commit 295f345b2e
1 changed files with 15 additions and 5 deletions

View File

@ -167,7 +167,6 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
{
GFile *file;
GFileInfo *file_info;
GtkIconInfo *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);
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);
}