From c3730a21a74bc7cc7097e3412ec046f00feec5b2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Nov 2016 06:58:41 +0530 Subject: [PATCH] Fix #1643364 [Better handling of non-existent tags](https://bugs.launchpad.net/calibre/+bug/1643364) --- src/calibre/gui2/dialogs/tag_editor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/dialogs/tag_editor.py b/src/calibre/gui2/dialogs/tag_editor.py index 7f4cbf21ae..374de6f955 100644 --- a/src/calibre/gui2/dialogs/tag_editor.py +++ b/src/calibre/gui2/dialogs/tag_editor.py @@ -131,6 +131,8 @@ class TagEditor(QDialog, Ui_TagEditor): def apply_tags(self, item=None): items = self.available_tags.selectedItems() if item is None else [item] rows = [self.available_tags.row(i) for i in items] + if not rows: + return row = max(rows) tags = self._get_applied_tags_box_contents() for item in items: @@ -227,6 +229,7 @@ class TagEditor(QDialog, Ui_TagEditor): def save_state(self): gprefs['tag_editor_geometry'] = bytearray(self.saveGeometry()) + if __name__ == '__main__': from calibre.gui2 import Application from calibre.library import db