From 3f36fa80fd09a448f3c207d48873fa6ca3532ef2 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 25 Jul 2013 23:03:54 +0800 Subject: [PATCH] fix nil pos bug in readerhighlight --- frontend/ui/reader/readerhighlight.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/ui/reader/readerhighlight.lua b/frontend/ui/reader/readerhighlight.lua index 9b9e40f08..d815791b1 100644 --- a/frontend/ui/reader/readerhighlight.lua +++ b/frontend/ui/reader/readerhighlight.lua @@ -68,13 +68,14 @@ end function ReaderHighlight:onTap(arg, ges) local function inside_box(ges, box) local pos = self.view:screenToPageTransform(ges.pos) - local x, y = pos.x, pos.y - if box.x <= x and box.y <= y - and box.x + box.w >= x - and box.y + box.h >= y then - return true + if pos then + local x, y = pos.x, pos.y + if box.x <= x and box.y <= y + and box.x + box.w >= x + and box.y + box.h >= y then + return true + end end - return false end if self.hold_pos then self.view.highlight.temp[self.hold_pos.page] = nil