From f40f41a88904df164f383ae55fc6283d1e3f099e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Dec 2011 09:00:34 +0530 Subject: [PATCH] E-book viewer: Do not popup an error message if the user tries to use the mouse wheel to scroll before a document is loaded. Fixes #903449 (exception raised in ebook-viewer) --- src/calibre/gui2/viewer/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index d1c8046dcc..db6d0d8b91 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -758,11 +758,12 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.set_page_number(frac) def next_document(self): - if self.current_index < len(self.iterator.spine) - 1: + if (hasattr(self, 'current_index') and self.current_index < + len(self.iterator.spine) - 1): self.load_path(self.iterator.spine[self.current_index+1]) def previous_document(self): - if self.current_index > 0: + if hasattr(self, 'current_index') and self.current_index > 0: self.load_path(self.iterator.spine[self.current_index-1], pos=1.0) def keyPressEvent(self, event):