From 30d6b30fecad92078a114396dd23f9294ee27b24 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 26 Aug 2024 16:39:54 +0530 Subject: [PATCH] E-book viewer: Fix a harmless error when the book contains page list references whose targets do not exist. Fixes #2077871 [Error when changing chapters](https://bugs.launchpad.net/calibre/+bug/2077871) --- src/pyj/read_book/anchor_visibility.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/read_book/anchor_visibility.pyj b/src/pyj/read_book/anchor_visibility.pyj index 5c30ec1003..f97cf501ea 100644 --- a/src/pyj/read_book/anchor_visibility.pyj +++ b/src/pyj/read_book/anchor_visibility.pyj @@ -24,7 +24,7 @@ def ensure_anchor_cache_valid(): def ensure_page_list_target_is_displayed(elem): # The stupid EPUB 3 examples have page list links pointing to # display:none divs. Sigh. - if window.getComputedStyle(elem).display is 'none': + if elem and window.getComputedStyle(elem).display is 'none': elem.textContent = '' elem.setAttribute('style', 'all: revert')