Permalink
Browse files

Fix two crashes related to pets

- when pet is killed by an instakill spell (for example "sacrifice" and had no target)
- when pet is being attacked and had not previous target
  • Loading branch information...
Zaffy committed Aug 21, 2017
1 parent 57972b9 commit 3611e8ac69492c93a928a01d33fc831682b0a321
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/game/PetAI.cpp
View
@@ -232,7 +232,7 @@ void PetAI::DamageDealt(Unit* victim, uint32& damage, DamageEffectType damageTyp
return;
Unit* owner = me->GetCharmerOrOwner();
if (!owner)
if (!owner || !me->GetVictim())
return;
if (!(me->GetVictim() == victim) && !me->GetVictim()->IsAlive())
@@ -560,7 +560,7 @@ void PetAI::AttackedBy(Unit* attacker)
return;
if (Unit* owner = me->GetOwner())
owner->SetInCombatWith(me->GetVictim());
owner->SetInCombatWith(attacker);
// Prevent pet from disengaging from current target
if (me->GetVictim() && me->GetVictim()->IsAlive())

1 comment on commit 3611e8a

@AbraKabastard

This comment has been minimized.

Show comment
Hide comment
@AbraKabastard

AbraKabastard Jan 22, 2018

Collaborator

Fixes #1542

Collaborator

AbraKabastard commented on 3611e8a Jan 22, 2018

Fixes #1542

Please sign in to comment.