From 7887c9b1cf4b54b7333bf0fb8c1cccf5c5fe8f03 Mon Sep 17 00:00:00 2001 From: zwim <36999612+zwim@users.noreply.github.com> Date: Sun, 31 Oct 2021 17:36:00 +0100 Subject: [PATCH] Fix crash in readerhighlight (#8396) --- frontend/apps/reader/modules/readerhighlight.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 4c1851016..9c0b6418f 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -179,7 +179,8 @@ function ReaderHighlight:init() return { text= _("Hyphenate"), show_in_highlight_dialog_func = function() - return _self.ui.userhyph and _self.ui.userhyph:isAvailable() and not _self.selected_text.text:find("[ ,;-%.\n]") + return _self.ui.userhyph and _self.ui.userhyph:isAvailable() + and not _self.selected_text.text:find("[ ,;-%.\n]") end, callback = function() _self.ui.userhyph:modifyUserEntry(_self.selected_text.text) @@ -746,6 +747,10 @@ function ReaderHighlight:removeFromHighlightDialog(idx) end function ReaderHighlight:onShowHighlightMenu() + if not self.selected_text then + return + end + local highlight_buttons = {{}} local columns = 2