Fix access out of bounds warning with Cppcheck 2.2 (#4438)

This commit is contained in:
Nathan Mills 2020-12-04 22:15:44 -08:00 committed by GitHub
parent 9f1ae2b761
commit ff2d4a950e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,8 +262,10 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
while (!StringUtils::safeGetline(in, line).eof()) while (!StringUtils::safeGetline(in, line).eof())
{ {
const std::u32string& u32line = StringUtils::utf8ToUtf32(line); const std::u32string& u32line = StringUtils::utf8ToUtf32(line);
if (u32line.empty())
continue;
char32_t thai = u32line[0]; char32_t thai = u32line[0];
if (u32line.empty() || !isThaiCP(thai)) if (!isThaiCP(thai))
continue; continue;
if (g_thai_dict.find(thai) == g_thai_dict.end()) if (g_thai_dict.find(thai) == g_thai_dict.end())
{ {