Fix for calculating the current position in the case of TOC containing links to external files:

when walking the TOC we should check if the destination page is within the range of the current document.
This commit is contained in:
Tigran Aivazian
2012-09-15 22:19:12 +01:00
parent dac88587bf
commit 853f34b488

View File

@@ -1740,10 +1740,11 @@ end
-- corresponding to the current page.
function UniReader:findTOCpos()
local pos, found_pos = 0, false
local numpages = self.doc:getPages()
-- find the index into toc_xview first
for k,v in ipairs(self.toc) do
if v.page > self.pageno then
if v.page >= 1 and v.page <= self.doc:getPages() and v.page > self.pageno then
pos = k - 1
found_pos = true
break