summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisenmann <p3732@getgoogleoff.me>2023-03-20 22:30:37 +0100
committerOndrej Holy <oholy@redhat.com>2023-03-29 14:10:40 +0000
commitbb97b053cd69d73b315e12a46a4beea6bbb10172 (patch)
treef35834f1b6c63dee660936ccd576594227520abd
parentcbd4c1d95e7f8ef7847c39fd28c66fbbaa25f941 (diff)
downloadnautilus-bb97b053cd69d73b315e12a46a4beea6bbb10172.tar.gz
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.
-rw-r--r--src/nautilus-files-view.c3
1 files changed, 2 insertions, 1 deletions
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))