From 9d7dc2e2faa0f94798364fa96f1762ae84c37887 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Jul 2020 20:58:11 +0530 Subject: [PATCH] Viewer: Fix a regression in the previous release that broke reading of books with mathematics and also tags without href attributes. Fixes #1886192 [EPUB crashes. Cannot read property 'startswith'.](https://bugs.launchpad.net/calibre/+bug/1886192) --- src/pyj/read_book/mathjax.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/read_book/mathjax.pyj b/src/pyj/read_book/mathjax.pyj index 50cdf09ad3..d179d9a5e1 100644 --- a/src/pyj/read_book/mathjax.pyj +++ b/src/pyj/read_book/mathjax.pyj @@ -19,7 +19,7 @@ def get_url(mathjax_files, name): def postprocess(link_uid): for a in document.getElementsByTagName('a'): href = a.getAttribute('href') - if href.startswith('#'): + if href and href.startswith('#'): a.setAttribute('href', 'javascript: void(0)') a.setAttribute('data-' + link_uid, JSON.stringify({'frag':href[1:]}))