avoid exception when switching between full and split pdf view

This commit is contained in:
Brian Gough 2016-06-14 12:49:06 +01:00
parent 2840a7757f
commit 991d3c7aa1

View file

@ -516,7 +516,15 @@ define [
first = highlights[0]
pageNum = scope.pages[first.page].pageNum
# switching between split and full pdf views can cause
# highlights to appear before rendering
if !scope.pages
return # ignore highlight scroll if still rendering
pageNum = scope.pages[first.page]?.pageNum
if !pageNum?
return # ignore highlight scroll if page not found
# use a visual offset of 72pt to match the offset in PdfController syncToCode
scope.document.getPdfViewport(pageNum).then (viewport) ->