From b4c9b07f6873f979085709f15594c210af4bbdb9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 14 Jan 2011 16:49:26 -0700 Subject: [PATCH] Fix #8352 (Alt-V gives error on book with no formats) --- src/calibre/gui2/actions/view.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/view.py b/src/calibre/gui2/actions/view.py index 0910745ac9..7b14de8176 100644 --- a/src/calibre/gui2/actions/view.py +++ b/src/calibre/gui2/actions/view.py @@ -92,7 +92,12 @@ class ViewAction(InterfaceAction): formats = [list(f.upper().split(',')) if f else None for f in formats] all_fmts = set([]) for x in formats: - for f in x: all_fmts.add(f) + if x: + for f in x: all_fmts.add(f) + if not all_fmts: + error_dialog(self.gui, _('Format unavailable'), + _('Selected books have no formats'), show=True) + return d = ChooseFormatDialog(self.gui, _('Choose the format to view'), list(sorted(all_fmts))) if d.exec_() == d.Accepted: