TouchMenu: Abort early if tap/hold handlers are called on an unpainted

widget

May happen if we have blocking stuff on startup (e.g., Wi-Fi), and you
spam tap the screen during the white screen.
This commit is contained in:
NiLuJe
2021-06-18 19:23:03 +02:00
parent c7232af8eb
commit 240a4acdcc

View File

@@ -157,6 +157,9 @@ function TouchMenuItem:onTapSelect(arg, ges)
end
if enabled == false then return end
-- If the menu hasn't actually been drawn yet, don't do anything (as it's confusing, and the coordinates may be wrong).
if not self.item_frame.dimen then return end
if G_reader_settings:isFalse("flash_ui") then
self.menu:onMenuSelect(self.item)
else
@@ -200,6 +203,8 @@ function TouchMenuItem:onHoldSelect(arg, ges)
end
if enabled == false then return end
if not self.item_frame.dimen then return end
if G_reader_settings:isFalse("flash_ui") then
self.menu:onMenuHold(self.item, self.text_truncated)
else