Core/Movement: shield ChaseMovementGenerator against a potential crash
Since GenericMovementGenerator can be built with any MOTION_TYPE (cherry picked from commit 98fd8d4c748942cc7d7acde97610b7b0688472de)
This commit is contained in:
@@ -31,7 +31,10 @@ static bool IsMutualChase(Unit* owner, Unit* target)
|
||||
if (target->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE)
|
||||
return false;
|
||||
|
||||
return (dynamic_cast<ChaseMovementGenerator const*>(target->GetMotionMaster()->GetCurrentMovementGenerator())->GetTarget() == owner);
|
||||
if (ChaseMovementGenerator* movement = dynamic_cast<ChaseMovementGenerator*>(target->GetMotionMaster()->GetCurrentMovementGenerator()))
|
||||
return movement->GetTarget() == owner;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool PositionOkay(Unit* owner, Unit* target, Optional<float> minDistance, Optional<float> maxDistance, Optional<ChaseAngle> angle)
|
||||
|
||||
Reference in New Issue
Block a user