From 56c8b28f7c2e3b6025730fba854352f541ecddce Mon Sep 17 00:00:00 2001 From: chrox Date: Fri, 12 Jul 2013 20:52:12 +0800 Subject: [PATCH] Fix bug #151 Check if there is only one line between the two positions and no word boxes are found, if so break the loop immediately. --- frontend/ui/reader/readerhighlight.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/ui/reader/readerhighlight.lua b/frontend/ui/reader/readerhighlight.lua index ee5c9d2d7..75c3e5695 100644 --- a/frontend/ui/reader/readerhighlight.lua +++ b/frontend/ui/reader/readerhighlight.lua @@ -355,6 +355,7 @@ function ReaderHighlight:getTextFromPositions(boxes, pos0, pos1) j_start, j_stop = j_stop, j_start end for i = i_start, i_stop do + if i_start == i_stop and #boxes[i] == 0 then break end -- insert line words local j0 = i > i_start and 1 or j_start local j1 = i < i_stop and #boxes[i] or j_stop