Script/Commands: Fix crash in .pet create command if Unit::CreateTamedPetFrom returns nullptr (#31218)

This commit is contained in:
HelloKitty
2025-08-18 09:28:37 -05:00
committed by GitHub
parent 760cd824bb
commit 33a8d42bd7

View File

@@ -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();