From fc1689415c9a9aacc597d125c18de491ed8c737b Mon Sep 17 00:00:00 2001 From: trickerer Date: Fri, 5 Apr 2024 08:47:58 +0700 Subject: [PATCH] NPCBots: Fix a crash due to missing `npc_text_locale` entry --- src/server/game/AI/NpcBots/bot_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp index fd6a19322b856..5f24a993c31f3 100644 --- a/src/server/game/AI/NpcBots/bot_ai.cpp +++ b/src/server/game/AI/NpcBots/bot_ai.cpp @@ -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;