Fix crash trying to select text in an empty page

pull/470/head
Paulo Matias 10 years ago
parent 44b2026028
commit dacd3d2acb

@ -593,6 +593,7 @@ end
get word and word box around pos
--]]
function KoptInterface:getWordFromBoxes(boxes, pos)
if not pos or #boxes == 0 then return {} end
local i, j = getWordBoxIndices(boxes, pos)
local lb = boxes[i]
local wb = boxes[i][j]
@ -613,7 +614,7 @@ end
get text and text boxes between pos0 and pos1
--]]
function KoptInterface:getTextFromBoxes(boxes, pos0, pos1)
if not pos0 or not pos1 then return {} end
if not pos0 or not pos1 or #boxes == 0 then return {} end
local line_text = ""
local line_boxes = {}
local i_start, j_start = getWordBoxIndices(boxes, pos0)

@ -296,7 +296,7 @@ function ReaderHighlight:lookup(selected_word)
local word_box = self.view:pageToScreenTransform(self.hold_pos.page, selected_word.sbox)
self.ui:handleEvent(Event:new("LookupWord", self, selected_word.word, word_box))
-- or we will do OCR
else
elseif selected_word.sbox then
local word = self.ui.document:getOCRWord(self.hold_pos.page, selected_word)
DEBUG("OCRed word:", word)
local word_box = self.view:pageToScreenTransform(self.hold_pos.page, selected_word.sbox)

Loading…
Cancel
Save