fix(Core/Creature): Nullcheck for questgreeting greeting (#19669)

* fix(Core/Creature): Nullcheck for questgreeting greeting

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/19659

* Update GossipDef.cpp
This commit is contained in:
Kitzunu
2024-08-18 11:41:18 +02:00
committed by GitHub
parent 167e06e287
commit e33a56d89b

View File

@@ -319,10 +319,16 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, std::string const
if (QuestGreeting const* questGreeting = sObjectMgr->GetQuestGreeting(guid.GetTypeId(), guid.GetEntry()))
{
LocaleConstant locale = _session->GetSessionDbLocaleIndex();
std::string strGreeting = questGreeting->Greeting[DEFAULT_LOCALE];
if (questGreeting->Greeting.size() > size_t(locale) && !questGreeting->Greeting.empty())
strGreeting = questGreeting->Greeting[locale];
std::string strGreeting;
// Check if greeting exists. Blizzlike that some creatures have empty greeting
if (!questGreeting->Greeting.empty())
{
LocaleConstant locale = _session->GetSessionDbLocaleIndex();
if (questGreeting->Greeting.size() > size_t(locale))
strGreeting = questGreeting->Greeting[locale];
else
strGreeting = questGreeting->Greeting[DEFAULT_LOCALE];
}
data << strGreeting;
data << uint32(questGreeting->EmoteDelay);