From b09783d111ed5a1e146fe478614f63c6e25c5e56 Mon Sep 17 00:00:00 2001 From: Blu3train Date: Mon, 29 Nov 2021 17:24:16 +0100 Subject: [PATCH] Moved test after filter --- extensions/translatewrapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/translatewrapper.cpp b/extensions/translatewrapper.cpp index 17b999d..f959bd1 100644 --- a/extensions/translatewrapper.cpp +++ b/extensions/translatewrapper.cpp @@ -153,7 +153,7 @@ private: bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) { - if (sentenceInfo["text number"] == 0 || sentence.size() > maxSentenceSize || !std::regex_replace(sentence, std::wregex(L"\\s|\u200B"), L"").length()) return false; + if (sentenceInfo["text number"] == 0 || sentence.size() > maxSentenceSize) return false; static class { @@ -188,6 +188,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) Trim(sentence); sentence.erase(std::remove_if(sentence.begin(), sentence.end(), [](wchar_t ch) { return ch < ' ' && ch != '\n'; }), sentence.end()); } + if (!std::regex_replace(sentence, std::wregex(L"\\s|\x200b"), L"").size()) return false; if (useCache) { auto translationCache = ::translationCache.Acquire();