Core/Pets: Fixed crash happening when summoning a different pet than one that was unsummoned by summoning a guardian (imp -> infernal -> felhunter)

Closes #25478

(cherry picked from commit d29274f3a142545a386420e54f6169e4f7ed6eda)
This commit is contained in:
Shauren
2022-01-31 00:23:57 +01:00
parent 9147918363
commit e102022eeb
+2 -2
View File
@@ -5820,8 +5820,8 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
{
// remove existing minion pet
if (oldPet->IsPet())
((Pet*)oldPet)->Remove(PET_SAVE_AS_CURRENT);
if (Pet* oldPetAsPet = oldPet->ToPet())
oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
else
oldPet->UnSummon();
SetPetGUID(minion->GetGUID());