mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Script/Commands: Fix crash in .pet create command if Unit::CreateTamedPetFrom returns nullptr (#31218)
This commit is contained in:
@@ -95,6 +95,12 @@ public:
|
||||
|
||||
// Everything looks OK, create new pet
|
||||
Pet* pet = player->CreateTamedPetFrom(creatureTarget);
|
||||
if (!pet)
|
||||
{
|
||||
handler->PSendSysMessage("CreateTamedPetFrom returned null.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// "kill" original creature
|
||||
creatureTarget->DespawnOrUnsummon();
|
||||
|
||||
Reference in New Issue
Block a user