diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-05-08 17:01:21 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-05-08 17:04:38 -0400 |
commit | 10a15760f0ba7d1b0a65693caf47a9b080742ed3 (patch) | |
tree | ae8e096bdfa7d525b575b37d26feaf0b1bb47fe6 | |
parent | c92532c8808815a776e377bf208bc194f077b169 (diff) | |
download | nautilus-10a15760f0ba7d1b0a65693caf47a9b080742ed3.tar.gz |
window-manage-views: don't call methods on a NULL NautilusFile
In got_file_info_for_view_selection_callback(), we unconditionally try
to fetch information for the parent directory in case the selection is a
regular file, but we should avoid doing that when the file has no
parent, such as when it's the root of a web server.
https://bugzilla.gnome.org/show_bug.cgi?id=675259
-rw-r--r-- | src/nautilus-window-manage-views.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 04f04b61a..1892c6efa 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -768,7 +768,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file, char *mimetype; NautilusWindow *window; NautilusWindowSlot *slot; - NautilusFile *viewed_file; + NautilusFile *viewed_file, *parent_file; GFile *location; GMountOperation *mount_op; MountNotMountedData *data; @@ -807,7 +807,9 @@ got_file_info_for_view_selection_callback (NautilusFile *file, return; } - if (nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR) { + parent_file = nautilus_file_get_parent (file); + if ((parent_file != NULL) && + nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR) { if (slot->pending_selection != NULL) { g_list_free_full (slot->pending_selection, (GDestroyNotify) nautilus_file_unref); } @@ -817,7 +819,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file, slot->pending_location = nautilus_file_get_parent_location (file); slot->pending_selection = g_list_prepend (NULL, nautilus_file_ref (file)); - slot->determine_view_file = nautilus_file_get_parent (file); + slot->determine_view_file = parent_file; slot->pending_scroll_to = nautilus_file_get_uri (file); nautilus_file_invalidate_all_attributes (slot->determine_view_file); @@ -831,6 +833,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file, return; } + nautilus_file_unref (parent_file); location = slot->pending_location; view_id = NULL; |