From bb97b053cd69d73b315e12a46a4beea6bbb10172 Mon Sep 17 00:00:00 2001 From: Peter Eisenmann Date: Mon, 20 Mar 2023 22:30:37 +0100 Subject: files-view: handle no focus state gracefully gtk_window_get_focus can return NULL. Passing that directly into gtk_widget_is_ancestor throws a GLib warning, so handle it explicitly. --- src/nautilus-files-view.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 0133b671c..ca78f4bce 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -3232,7 +3232,8 @@ nautilus_files_view_focus (GtkWidget *widget, /* In general, we want to forward focus movement to the main child. However, * we must chain up for default focus handling in case the focus in in any * other child, e.g. a popover. */ - if (gtk_widget_is_ancestor (focus, widget) && + if (focus != NULL && + gtk_widget_is_ancestor (focus, widget) && !gtk_widget_is_ancestor (focus, priv->scrolled_window)) { if (GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->focus (widget, direction)) -- cgit v1.2.1