summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2022-07-10 12:14:09 -0400
committerAntónio Fernandes <antoniof@gnome.org>2022-07-30 20:23:15 +0000
commit0c1f2fe55300b0f81b323191ecc56c3250a5c1e4 (patch)
treebddeffe000d36be2887ed5ca6659cb4d44b1b833
parentc279180a9268e3b6d3749affb27917778b3a7b47 (diff)
downloadnautilus-0c1f2fe55300b0f81b323191ecc56c3250a5c1e4.tar.gz
window: Close window when closing last tab
Prevents a crash from trying to update the selected page after the last page is closed. Instead of letting the code progress to that point, we simply check for the number of pages and close the window at the right point.
-rw-r--r--src/nautilus-window.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 0acd81a56..d37c44eb3 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -157,6 +157,12 @@ action_close_current_view (GSimpleAction *action,
NautilusWindow *window = user_data;
AdwTabPage *page = window->menu_page;
+ if (adw_tab_view_get_n_pages (window->tab_view) <= 1)
+ {
+ nautilus_window_close (window);
+ return;
+ }
+
if (page == NULL)
{
page = adw_tab_view_get_selected_page (window->tab_view);