Core/Creature: ported assert crashfix that fixes a focus related crash that was happening when dismissing a warlock pet while it was casting a spell

This commit is contained in:
Ovahlord
2019-09-02 00:36:34 +02:00
parent d78d787292
commit 1f78a55f20
2 changed files with 6 additions and 7 deletions

View File

@@ -3080,7 +3080,11 @@ void Creature::ReleaseSpellFocus(Spell const* focusSpell, bool withDelay)
void Creature::ReacquireSpellFocusTarget()
{
ASSERT(HasSpellFocus());
if (!HasSpellFocus())
{
TC_LOG_ERROR("entities.unit", "Creature::ReacquireSpellFocusTarget() being alled with HasSpellFocus() return false.");
return;
}
SetGuidValue(UNIT_FIELD_TARGET, _spellFocusInfo.target);

View File

@@ -261,17 +261,12 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
if (pet->IsPet())
{
if (((Pet*)pet)->IsHunterPet())
{
GetPlayer()->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
}
else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
pet->setDeathState(CORPSE);
GetPlayer()->RemovePet((Pet*)pet, PET_SAVE_DISMISS);
}
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
{
((Minion*)pet)->UnSummon();
}
}
break;
case COMMAND_MOVE_TO: