From ff2d4a950ee9cb83406538865b6327fb3fc4d92b Mon Sep 17 00:00:00 2001 From: Nathan Mills <38995150+Quipyowert2@users.noreply.github.com> Date: Fri, 4 Dec 2020 22:15:44 -0800 Subject: [PATCH] Fix access out of bounds warning with Cppcheck 2.2 (#4438) --- src/utils/translation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/translation.cpp b/src/utils/translation.cpp index a7267f644..5f5c9b2c1 100644 --- a/src/utils/translation.cpp +++ b/src/utils/translation.cpp @@ -262,8 +262,10 @@ Translations::Translations() //: m_dictionary_manager("UTF-16") while (!StringUtils::safeGetline(in, line).eof()) { const std::u32string& u32line = StringUtils::utf8ToUtf32(line); + if (u32line.empty()) + continue; char32_t thai = u32line[0]; - if (u32line.empty() || !isThaiCP(thai)) + if (!isThaiCP(thai)) continue; if (g_thai_dict.find(thai) == g_thai_dict.end()) {