Skip to content

Commit

Permalink
NPCBots: Fix a crash due to missing npc_text_locale entry
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Apr 5, 2024
1 parent a2374bf commit fc16894
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const std::string& bot_ai::LocalizedNpcText(Player const* forPlayer, uint32 text
{
std::wstring wnamepart;
NpcTextLocale const* ntl = sObjectMgr->GetNpcTextLocale(textId);
if (loc != DEFAULT_LOCALE && ntl && !ntl->Text_0[0][loc].empty() && Utf8FitTo(ntl->Text_0[0][loc], wnamepart))
if (loc != DEFAULT_LOCALE && ntl && ntl->Text_0[0].size() > size_t(loc) && !ntl->Text_0[0][loc].empty() && Utf8FitTo(ntl->Text_0[0][loc], wnamepart))
return ntl->Text_0[0][loc];
else
return nt->Options[0].Text_0;
Expand Down

0 comments on commit fc16894

Please sign in to comment.