From 948d92a3b3b60193f1e0ba6fd3176d63dfed2b84 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 14:45:11 +0800 Subject: [PATCH] fix tap on word title will crash koreader --- frontend/ui/uimanager.lua | 4 +++- frontend/ui/widget/button.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 74d8df49f..9d2c79ea4 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -249,7 +249,9 @@ function UIManager:setDirty(widget, refresh_type) if not refresh_type then refresh_type = "auto" end - self._dirty[widget] = refresh_type + if widget then + self._dirty[widget] = refresh_type + end end function UIManager:insertZMQ(zeromq) diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index 68a6e3f03..714a652cb 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -147,7 +147,7 @@ function Button:showHide(show) end function Button:onTapSelect() - if self.enabled then + if self.enabled and self.callback then self[1].invert = true UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.1, function()