From 7e05b72d83f7e039141b271e32cbd76ab6b96364 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Fri, 30 Apr 2021 20:46:30 +0200 Subject: [PATCH] Hotfix of unhandled exception by language_tool_python (#870) Signed-off-by: TheJackiMonster --- manuskript/functions/spellchecker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manuskript/functions/spellchecker.py b/manuskript/functions/spellchecker.py index 131cd8e..b4ae0d2 100644 --- a/manuskript/functions/spellchecker.py +++ b/manuskript/functions/spellchecker.py @@ -552,7 +552,10 @@ class LanguageToolDictionary(BasicDictionary): @staticmethod def getTool(): if LanguageToolDictionary._tool == None: - LanguageToolDictionary._tool = languagetool.LanguageTool() + try: + LanguageToolDictionary._tool = languagetool.LanguageTool() + except: + return None return LanguageToolDictionary._tool @@ -569,7 +572,7 @@ class LanguageToolDictionary(BasicDictionary): @staticmethod def isInstalled(): - if languagetool != None: + if (languagetool != None) and (LanguageToolDictionary.getTool() != None): # This check, if Java is installed, is necessary to # make sure LanguageTool can be run without problems.