mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
fix(Core/Pets): fixed crash happening when current pet is forcibly removed (#10025)
This commit is contained in:
@@ -10168,10 +10168,15 @@ 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());
|
||||
SetMinionGUID(ObjectGuid::Empty);
|
||||
}
|
||||
@@ -10239,6 +10244,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
||||
{
|
||||
// All summoned by totem minions must disappear when it is removed.
|
||||
if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
|
||||
{
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
|
||||
@@ -10246,6 +10252,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
||||
|
||||
RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
Reference in New Issue
Block a user