From 4f130367579d6c2bc61a80d8a1a03a765d67f890 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 25 Jun 2014 09:38:17 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tweak_book/boss.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index fa9e8c05f6..b5f9b6dbc0 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -407,6 +407,9 @@ class Boss(QObject): self.set_modified() def edit_toc(self): + if current_container() is None: + return error_dialog(self.gui, _('No book opened'), _( + 'You must open a book before trying to edit the Table of Contents.'), show=True) self.add_savepoint(_('Before: Edit Table of Contents')) d = TOCEditor(title=self.current_metadata.title, parent=self.gui) if d.exec_() != d.Accepted: