diff --git a/Source/Contents/MessageTable.cpp b/Source/Contents/MessageTable.cpp index 63f980dda..f05e26c8a 100644 --- a/Source/Contents/MessageTable.cpp +++ b/Source/Contents/MessageTable.cpp @@ -4920,25 +4920,23 @@ const char* LookupMessage(int id) { } auto found = g_messageStrings.find(id); - if (found != g_messageStrings.end()) { - const std::string& text = found->second; - if (!g_inlineCharset || text[0] == '/' || text == "NO MSG") { - return text.c_str(); + if (g_messageStrings.end() != found) { + if (!g_inlineCharset || found->second[0] == '/' || found->second == "NO MSG") { + return found->second.c_str(); } // STATIC: 0x016D57B4 // GLOBAL: gl_24383 static std::vector cached(4698); - std::string& result = cached[id]; - if (result.empty() || g_serviceType == 19) { + if (cached[id].empty() || g_serviceType == 19) { // STATIC: 0x016D57C8 // GLOBAL: gl_24384 static char buffer[260]; - _snprintf_s(buffer, sizeof(buffer), _TRUNCATE, "%s%s", g_serverLanguage->Prefix(true), text.c_str()); - result = buffer; + _snprintf_s(buffer, sizeof(buffer), _TRUNCATE, "%s%s", g_serverLanguage->Prefix(true), found->second.c_str()); + cached[id] = buffer; } - return result.c_str(); + return cached[id].c_str(); } return "NO MSG";