mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Prevent crash by guarding creatureData against nullptr
This commit is contained in:
@@ -53,8 +53,13 @@ CDPairCalculatedValue::CDPairCalculatedValue(PlayerbotAI* botAI, std::string con
|
||||
std::string const CDPairCalculatedValue::Format()
|
||||
{
|
||||
CreatureData const* creatureData = Calculate();
|
||||
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id1);
|
||||
return bmTemplate ? bmTemplate->Name : "<none>";
|
||||
if (creatureData)
|
||||
{
|
||||
CreatureTemplate const* bmTemplate = sObjectMgr->GetCreatureTemplate(creatureData->id1);
|
||||
return bmTemplate ? bmTemplate->Name : "<none>";
|
||||
}
|
||||
|
||||
return "<none>";
|
||||
}
|
||||
|
||||
CDPairListCalculatedValue::CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
|
||||
Reference in New Issue
Block a user