From b1e20978c1e20c49c5843284328d0cf89d118368 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 12 Aug 2022 17:18:17 +0530 Subject: [PATCH] Fix #1985973 [Context menu fails in the Editor](https://bugs.launchpad.net/calibre/+bug/1985973) --- src/calibre/gui2/tweak_book/editor/widget.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 420b60e3d2..7fc2bf2768 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -543,7 +543,7 @@ class Editor(QMainWindow): c.setPosition(orig_pos - utf16_length(word)) found = False self.editor.setTextCursor(c) - if self.editor.find_spell_word([word], locale.langcode, center_on_cursor=False): + if locale and self.editor.find_spell_word([word], locale.langcode, center_on_cursor=False): found = True fc = self.editor.textCursor() if fc.position() < c.position():