Viewer: Fix an error when processing a CFI with an invalid text offset. Fixes #1848320 [E-book viewer - Error: Unhandled error](https://bugs.launchpad.net/calibre/+bug/1848320)

This commit is contained in:
Kovid Goyal 2019-10-16 18:26:08 +05:30
parent 95da08c893
commit 6abbf2221e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -468,7 +468,7 @@ def point(cfi, doc): # {{{
try_list = [{'start':0, 'end':0, 'a':0.5}, {'start':-1, 'end':0, 'a':0}, {'start':0, 'end':1, 'a':1}] try_list = [{'start':0, 'end':0, 'a':0.5}, {'start':-1, 'end':0, 'a':0}, {'start':0, 'end':1, 'a':1}]
a = None a = None
rects = None rects = None
node_len = node.nodeValue.length node_len = node.nodeValue.length if node.nodeValue else 0
offset = r.offset offset = r.offset
for v'var i = 0; i < 2; i++': for v'var i = 0; i < 2; i++':
# Try reducing the offset by 1 if we get no match as if it refers to the position after the # Try reducing the offset by 1 if we get no match as if it refers to the position after the