Script/Commands: Fix crash in .pet create command if Unit::CreateTamedPetFrom returns null

Port From (https://github.com/TrinityCore/TrinityCore/commit/33a8d42bd79265dcc6930b67f8ceb26622d5e0fe)
This commit is contained in:
Hondacrx
2025-08-25 21:53:28 -04:00
parent 48627e0741
commit c1a6aa0752
+5
View File
@@ -39,6 +39,11 @@ namespace Game.Chat
// Everything looks OK, create new pet
Pet pet = player.CreateTamedPetFrom(creatureTarget);
if (pet == null)
{
handler.SendSysMessage("CreateTamedPetFrom returned null.");
return false;
}
// "kill" original creature
creatureTarget.DespawnOrUnsummon();