guard against g_file_query_info() returning NULL (if the file doesn't

2008-07-22  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpviewrendererimagefile.c
	(gimp_view_renderer_imagefile_get_icon): guard against
	g_file_query_info() returning NULL (if the file doesn't exist or
	whatever error).


svn path=/trunk/; revision=26277
This commit is contained in:
Michael Natterer
2008-07-22 14:50:37 +00:00
committed by Michael Natterer
parent 7750d317c8
commit f3ffe972eb
2 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2008-07-22 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpviewrendererimagefile.c
(gimp_view_renderer_imagefile_get_icon): guard against
g_file_query_info() returning NULL (if the file doesn't exist or
whatever error).
2008-07-22 Michael Natterer <mitch@gimp.org>
* app/tools/gimpcolortool.c: set scroll_lock to TRUE while moving

View File

@ -169,18 +169,24 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
{
GFile *file;
GFileInfo *file_info;
GIcon *icon;
GtkIconInfo *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);
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 (file_info)
{
GIcon *icon;
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);
g_object_unref (file_info);
}
g_object_unref (file);
g_object_unref (file_info);
}
#endif