[evince] libview: Fix warning with no document loaded



commit 90b1d4f8874aeb2bf4b20eb2a996316deb250a02
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 24 14:33:58 2015 +0100

    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 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index dd8278d..9fa0546 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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]