[nautilus] window: avoid crash for null sidebar location



commit 72e8c481e83f5145bcc5ec7ff031e587596b2be4
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Sep 8 16:55:40 2015 +0200

    window: avoid crash for null sidebar location
    
    Currently if there is no row selected for the sidebar,
    its location is NULL. So when the properties actions is
    performed, the location is always NULL for no sidebar
    locations.
    Probably we want to fix that on the sidebar. But also protect
    ourselves about it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754677

 src/nautilus-window.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 209719f..f9718a5 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1071,12 +1071,20 @@ action_properties (GSimpleAction *action,
        NautilusFile *file;
 
        selected = gtk_places_sidebar_get_location (GTK_PLACES_SIDEBAR (window->priv->places_sidebar));
+
+        /* Currently the sidebar returns NULL if the current location is not in
+         * the sidebar */
+        if (selected == NULL)
+                goto done;
+
        file = nautilus_file_get (selected);
-       g_object_unref (selected);
 
        list = g_list_append (NULL, file);
        nautilus_properties_window_present (list, GTK_WIDGET (window), NULL);
        nautilus_file_list_free (list);
+
+done:
+       g_object_unref (selected);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]