Fix #1924872 [Shift select with no current selection results in error](https://bugs.launchpad.net/calibre/+bug/1924872)

This commit is contained in:
Kovid Goyal 2021-04-18 08:38:32 +05:30
parent f03f2c06a4
commit 6ec52ff451
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 2 deletions

View File

@ -628,7 +628,10 @@ def ensure_selection_visible():
def ensure_selection_boundary_visible(use_end):
sel = window.getSelection()
try:
rr = sel.getRangeAt(0)
except:
rr = None
if rr:
r = rr.getBoundingClientRect()
if r:

View File

@ -569,7 +569,10 @@ def snap_to_selection():
def ensure_selection_boundary_visible(use_end):
sel = window.getSelection()
try:
rr = sel.getRangeAt(0)
except:
rr = None
if rr:
r = rr.getBoundingClientRect()
if r: