[nautilus] window-slot: check location before constructing tab restore data



commit e5d98fee7026a9304cc232402be09f8082e01b8f
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sun Jul 23 19:53:47 2017 +0300

    window-slot: check location before constructing tab restore data
    
    Assuming that the location cannot be null can leads to crashes in cases
    when the user is trying to open non-existent locations, e.g. broken
    bookmarks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785317

 src/nautilus-window-slot.c |    5 +++++
 src/nautilus-window.c      |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 39d6229..1028d2b 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -181,6 +181,11 @@ nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *self)
 
     priv = nautilus_window_slot_get_instance_private (self);
 
+    if (priv->location == NULL)
+    {
+        return NULL;
+    }
+
     back_list = g_list_copy_deep (priv->back_list,
                                   (GCopyFunc) g_object_ref,
                                   NULL);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 442dd0e..bdfc024 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1620,7 +1620,10 @@ nautilus_window_slot_close (NautilusWindow     *window,
     }
 
     data = nautilus_window_slot_get_restore_tab_data (slot);
-    g_queue_push_head (priv->tab_data_queue, data);
+    if (data != NULL)
+    {
+        g_queue_push_head (priv->tab_data_queue, data);
+    }
 
     close_slot (window, slot, TRUE);
 


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