Fix crash trying to select text in an empty page

This commit is contained in:
Paulo Matias
2014-01-19 01:03:28 -02:00
parent 44b2026028
commit dacd3d2acb
2 changed files with 3 additions and 2 deletions

View File

@@ -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)