[gthumb] check whther file is NULL before usgin it
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] check whther file is NULL before usgin it
- Date: Sat, 27 Feb 2010 12:03:24 +0000 (UTC)
commit f766b500c6f6552be513eecf7433bb6185c6c8d4
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Feb 27 12:36:18 2010 +0100
check whther file is NULL before usgin it
gthumb/gtk-utils.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 4cae780..062b6e7 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -698,14 +698,20 @@ static GdkPixbuf *
get_file_icon_pixbuf (GFileIcon *icon,
int size)
{
+ GdkPixbuf *pixbuf = NULL;
GFile *file;
- char *filename;
- GdkPixbuf *pixbuf;
file = g_file_icon_get_file (icon);
- filename = g_file_get_path (file);
- pixbuf = gdk_pixbuf_new_from_file_at_size (filename, size, -1, NULL);
- g_free (filename);
+ if (file != NULL) {
+ char *filename;
+
+ filename = g_file_get_path (file);
+ if (filename != NULL)
+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename, size, -1, NULL);
+
+ g_free (filename);
+ }
+
g_object_unref (file);
return pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]