From 8fbf09a641d5d568424825484e83698c74b61c5f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 14 May 2022 17:29:09 +0530 Subject: [PATCH] Fix #1973400 [Private bug](https://bugs.launchpad.net/calibre/+bug/1973400) --- src/calibre/gui2/viewer/toc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer/toc.py b/src/calibre/gui2/viewer/toc.py index 6c22d5d108..cb1f7ee80a 100644 --- a/src/calibre/gui2/viewer/toc.py +++ b/src/calibre/gui2/viewer/toc.py @@ -264,7 +264,10 @@ class TOC(QStandardItemModel): def find_items(self, query): for item in self.all_items: text = item.text() - if not query or (text and primary_contains(query, text)): + if query and isinstance(query, str): + if text and isinstance(text, str) and primary_contains(query, text): + yield item + else: yield item def items_at_depth(self, depth):