lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |    8 
++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit bf980c7b7c8197724cbebd1ed16dfe4401b97392
Author:     Gökay Şatır <[email protected]>
AuthorDate: Mon Sep 2 17:27:56 2024 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Tue Sep 3 15:27:19 2024 +0200

    Return earlier if there are no proposals from Duden checker.
    
    Signed-off-by: Gökay Şatır <[email protected]>
    Change-Id: I71db986e5e5d79e5d94ae27343d2ee9944c2706d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172744
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index e0a9fd8a718d..c1f26d5c9992 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -240,6 +240,10 @@ void parseDudenResponse(ProofreadingResult& rResult, 
std::string&& aJSONBody)
     rResult.aErrors = parseJson(
         std::move(aJSONBody), "check-positions",
         [](const boost::property_tree::ptree& rPos, SingleProofreadingError& 
rError) {
+            const auto proposals = rPos.get_child_optional("proposals");
+            if (!proposals || proposals->empty())
+                return;
+
             rError.nErrorStart = rPos.get<int>("offset", 0);
             rError.nErrorLength = rPos.get<int>("length", 0);
             rError.nErrorType = text::TextMarkupType::PROOFREADING;
@@ -247,10 +251,6 @@ void parseDudenResponse(ProofreadingResult& rResult, 
std::string&& aJSONBody)
             //rError.aFullComment = ??
             const std::string sType = rPos.get<std::string>("type", {});
             rError.aProperties = { lcl_GetLineColorPropertyFromErrorId(sType) 
};
-
-            const auto proposals = rPos.get_child_optional("proposals");
-            if (!proposals)
-                return;
             rError.aSuggestions.realloc(std::min(proposals->size(), 
MAX_SUGGESTIONS_SIZE));
             auto itProp = proposals->begin();
             for (auto& rSuggestion : asNonConstRange(rError.aSuggestions))

Reply via email to