mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user