From 4c89a7e697e02674b00f4be231e5c756bdddec81 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 13 Jan 2023 07:46:38 +0530 Subject: [PATCH] Fix #2002753 [Error when ejecting while in Device Mode](https://bugs.launchpad.net/calibre/+bug/2002753) --- src/calibre/gui2/library/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 96772474fc..c76ca43a37 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1701,6 +1701,10 @@ class DeviceBooksModel(BooksModel): # {{{ def current_changed(self, current, previous, emit_signal=True): if current.isValid(): idx = current.row() + try: + self.db[self.map[idx]] + except Exception: + return # can happen if the device is ejected try: data = self.get_book_display_info(idx) except Exception: