From 9b81dd7090a7ea93d374b9ebc873ee61659be0dc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 Nov 2025 08:49:58 +0530 Subject: [PATCH] Fix #2132137 ['NoneType' object has no attribute 'underlying_book_id'](https://bugs.launchpad.net/calibre/+bug/2132137) --- src/calibre/gui2/library/delegates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index d8ea501c9b..83a8797e21 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -209,7 +209,7 @@ class StyledItemDelegate(QStyledItemDelegate): def createEditor(self, parent, option, index): e = self.create_editor(parent, option, index) - if (book_id := index.data(Qt.ItemDataRole.UserRole)) and isinstance(book_id, int): + if e is not None and (book_id := index.data(Qt.ItemDataRole.UserRole)) and isinstance(book_id, int): setattr(e, 'underlying_book_id', book_id) return e