mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 17:43:47 +00:00
fix(Core/Pets): Fix crash when pet tries to attack deleted object (#17034)
This situation occurs when, during a fight, a pet receives a command to apply a positive spell to an ally and then resume attacking its previous target.
This commit is contained in:
committed by
GitHub
parent
7529994a5c
commit
f6b77f9d64
@@ -530,7 +530,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellId, unit_target, nullptr, tempspellIsPositive);
|
||||
pet->ToPet()->CastWhenWillAvailable(spellId, unit_target, ObjectGuid::Empty, tempspellIsPositive);
|
||||
}
|
||||
}
|
||||
else if (haspositiveeffect)
|
||||
@@ -566,7 +566,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellId, unit_target, victim, tmpSpellIsPositive);
|
||||
ObjectGuid oldTarget = ObjectGuid::Empty;
|
||||
if (victim)
|
||||
oldTarget = victim->GetGUID();
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellId, unit_target, oldTarget, tmpSpellIsPositive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user