From f56aee73f09b68a20f827b3c1a76601770f654c2 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 10 Mar 2022 09:46:47 -0500 Subject: [PATCH] Core/Pets: Fixed crash happening when summoning a different pet than one that was unsummoned by summoning a guardian (imp -> infernal -> felhunter) Port From (https://github.com/TrinityCore/TrinityCore/commit/e102022eeb8a0fd402e34de92468b2afb8f1f006) --- Source/Game/Entities/Unit/Unit.Pets.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index 34c2712aa..d1fa62988 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -127,8 +127,9 @@ namespace Game.Entities if (oldPet != minion && (oldPet.IsPet() || minion.IsPet() || oldPet.GetEntry() != minion.GetEntry())) { // remove existing minion pet - if (oldPet.IsPet()) - ((Pet)oldPet).Remove(PetSaveMode.AsCurrent); + Pet oldPetAsPet = oldPet.ToPet(); + if (oldPetAsPet != null) + oldPetAsPet.Remove(PetSaveMode.NotInSlot); else oldPet.UnSummon(); SetPetGUID(minion.GetGUID());