Skip to content

Commit

Permalink
libview: Fix warning with no document loaded
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Bastien Nocera committed Nov 24, 2015
1 parent bf45fe7 commit 90b1d4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libview/ev-view.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 90b1d4f

Please sign in to comment.