diff options
author | António Fernandes <antoniof@gnome.org> | 2021-02-27 15:49:05 +0000 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2021-03-12 15:07:07 +0000 |
commit | e771411670e304dee6288e9278b6bf98da561014 (patch) | |
tree | 11a2b7a6e0d31bb06420e211787e487f3a5301b8 /src | |
parent | 13de21b47fac39fcdcb2a72990d4a8b04a870bd2 (diff) | |
download | nautilus-e771411670e304dee6288e9278b6bf98da561014.tar.gz |
window: Handle NULL active_slot pointer
This pointer may be NULL. Usually this may happen only during window
initialization and destruction. However, for robustness, make sure
every use either handles a NULL pointer or asserts it's non-NULL.
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-window.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index e4294f6dd..53a4fa527 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1434,7 +1434,7 @@ nautilus_window_slot_close (NautilusWindow *window, NautilusNavigationState *data; DEBUG ("Requesting to remove slot %p from window %p", slot, window); - if (window == NULL) + if (window == NULL || slot == NULL) { return; } @@ -1465,7 +1465,7 @@ nautilus_window_sync_bookmarks (NautilusWindow *window) GFile *location; slot = window->active_slot; - location = nautilus_window_slot_get_location (slot); + location = slot != NULL ? nautilus_window_slot_get_location (slot) : NULL; if (location != NULL) { @@ -1487,6 +1487,9 @@ nautilus_window_sync_location_widgets (NautilusWindow *window) gboolean enabled; slot = window->active_slot; + /* This function is called by the active slot. */ + g_assert (slot != NULL); + location = nautilus_window_slot_get_location (slot); /* Change the location bar and path bar to match the current location. */ @@ -1766,6 +1769,11 @@ nautilus_window_show_operation_notification (NautilusWindow *window, NautilusFile *folder; GFile *current_location; + if (window->active_slot == NULL) + { + return; + } + current_location = nautilus_window_slot_get_location (window->active_slot); if (gtk_window_has_toplevel_focus (GTK_WINDOW (window))) { @@ -2520,7 +2528,8 @@ nautilus_window_key_press_event (GtkWidget *widget, return GDK_EVENT_STOP; } - if (nautilus_window_slot_handle_event (window->active_slot, (GdkEvent *) event)) + if (window->active_slot != NULL && + nautilus_window_slot_handle_event (window->active_slot, (GdkEvent *) event)) { return GDK_EVENT_STOP; } |