[gtk+] file chooser: Avoid warnings from the location column
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] file chooser: Avoid warnings from the location column
- Date: Mon, 2 Mar 2015 21:26:00 +0000 (UTC)
commit d2fe45ab5754fa4fdb437516cabf02dec5eb5593
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 2 15:38:29 2015 -0500
file chooser: Avoid warnings from the location column
Avoid criticals that would come out of this code if file is / or NULL.
gtk/gtkfilechooserwidget.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index bd39b8d..0f39ca2 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -4066,11 +4066,14 @@ file_system_model_set (GtkFileSystemModel *model,
gchar *location;
home_location = g_file_new_for_path (g_get_home_dir ());
- dir_location = g_file_get_parent (file);
+ if (file)
+ dir_location = g_file_get_parent (file);
+ else
+ dir_location = NULL;
- if (g_file_equal (home_location, dir_location))
+ if (dir_location && g_file_equal (home_location, dir_location))
location = g_strdup (_("Home"));
- else if (g_file_has_prefix (dir_location, home_location))
+ else if (dir_location && g_file_has_prefix (dir_location, home_location))
{
gchar *relative_path;
@@ -4084,7 +4087,8 @@ file_system_model_set (GtkFileSystemModel *model,
g_value_take_string (value, location);
- g_object_unref (dir_location);
+ if (dir_location)
+ g_object_unref (dir_location);
g_object_unref (home_location);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]