From 90b1d4f8874aeb2bf4b20eb2a996316deb250a02 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 24 Nov 2015 14:33:58 +0100 Subject: [PATCH] libview: Fix warning with no document loaded When switching to the view in gnome-documents or gnome-books, the EvView would get a focus event before the document was loaded, where we'd try to access structures that were only there if the document was loaded. https://bugzilla.gnome.org/show_bug.cgi?id=758596 --- libview/ev-view.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libview/ev-view.c b/libview/ev-view.c index dd8278da..9fa05467 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -7300,8 +7300,10 @@ ev_view_focus (GtkWidget *widget, { EvView *view = EV_VIEW (widget); - if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD) - return ev_view_focus_next (view, direction); + if (view->document) { + if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD) + return ev_view_focus_next (view, direction); + } return GTK_WIDGET_CLASS (ev_view_parent_class)->focus (widget, direction); }