languagesupport: check that ui.languagesupport is non-nil

Now that FileManager registers its UI modules in the same way as Reader,
this shouldn't be necessary but this protects us against some other app
creating a ReaderDictionary instance without having ui.languagesupport
registered properly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2021-10-25 17:45:26 +11:00
committed by poire-z
parent cdbedcbcce
commit de7c1e20c5
2 changed files with 3 additions and 3 deletions

View File

@@ -801,7 +801,7 @@ end
function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
local words = {word}
if self.ui.languagesupport:hasActiveLanguagePlugins() then
if self.ui.languagesupport and self.ui.languagesupport:hasActiveLanguagePlugins() then
-- Get any other candidates from any language-specific plugins we have.
-- We prefer the originally selected word first (in case there is a
-- dictionary entry for whatever text the user selected).