Fix crash at startUp due to command localization loading

The crash was due to MAX_LOCALE = 9 in Mangos One compared to MAX_LOCALE = 8 in mangos Zero
This commit is contained in:
Elmsroth 2020-06-07 16:20:56 +01:00 committed by Antz
parent 64e1346ce5
commit 92b81ca596

View file

@ -26,7 +26,7 @@
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "ProgressBar.h" #include "ProgressBar.h"
class ChatCommand; // Forward declaration of class ChatCommand; // Forward declaration of
INSTANTIATE_SINGLETON_1(CommandMgr); INSTANTIATE_SINGLETON_1(CommandMgr);
@ -70,7 +70,7 @@ void CommandMgr::LoadCommandHelpLocale()
uint32 commandId = fields[0].GetUInt32(); // to assign with db data uint32 commandId = fields[0].GetUInt32(); // to assign with db data
CommandHelpLocale& data = m_CommandHelpLocaleMap[commandId]; CommandHelpLocale& data = m_CommandHelpLocaleMap[commandId];
for (int i = 1; i <= MAX_LOCALE; ++i) for (int i = 1; i < MAX_LOCALE; ++i)
{ {
std::string str = fields[i].GetCppString(); std::string str = fields[i].GetCppString();
if (!str.empty()) if (!str.empty())
@ -114,7 +114,7 @@ void CommandMgr::GetCommandHelpLocaleString(uint32 commandId, int32 loc_idx, std
if (namePtr && il->HelpText.size() > size_t(loc_idx) && !il->HelpText[loc_idx].empty()) if (namePtr && il->HelpText.size() > size_t(loc_idx) && !il->HelpText[loc_idx].empty())
{ {
*namePtr = il->HelpText[loc_idx]; *namePtr = il->HelpText[loc_idx];
} }
} }
} }
} }