From 6e5a4246408576fd0ddf6bc406bb06e3ac5bf89e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Dec 2022 07:57:56 +0530 Subject: [PATCH] Fix a regression in the previous release that caused spurious error message when doing some out of band searches. Fixes #1999936 [IndexError: tuple index out of range](https://bugs.launchpad.net/calibre/+bug/1999936) --- src/calibre/gui2/library/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 543eb8e40a..8069af295e 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -620,6 +620,13 @@ class BooksModel(QAbstractTableModel): # {{{ def current_changed(self, current, previous, emit_signal=True): if current.isValid(): idx = current.row() + try: + self.db.id(idx) + except Exception: + # can happen if an out of band search is done causing the index + # to no longer be valid since this function is now called after + # an event loop tick. + return try: data = self.get_book_display_info(idx) except Exception: