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)

This commit is contained in:
Kovid Goyal 2024-08-26 16:39:54 +05:30
parent 8185000d0b
commit 30d6b30fec
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -24,7 +24,7 @@ def ensure_anchor_cache_valid():
def ensure_page_list_target_is_displayed(elem): def ensure_page_list_target_is_displayed(elem):
# The stupid EPUB 3 examples have page list links pointing to # The stupid EPUB 3 examples have page list links pointing to
# display:none divs. Sigh. # display:none divs. Sigh.
if window.getComputedStyle(elem).display is 'none': if elem and window.getComputedStyle(elem).display is 'none':
elem.textContent = '' elem.textContent = ''
elem.setAttribute('style', 'all: revert') elem.setAttribute('style', 'all: revert')