[9434] Prevent crash at script call that modify movegen list at MovementInform call.

This commit is contained in:
VladimirMangos 2010-02-22 20:29:32 +03:00
parent 244d25189c
commit f47f5a1deb
3 changed files with 14 additions and 3 deletions

View file

@ -206,6 +206,17 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
i_hasDone[idx] = true;
MovementInform(creature);
// force stop processing (script change movegen list)
if (creature.GetMotionMaster()->empty() || creature.GetMotionMaster()->top() != this)
return true; // not expire now, but already lost
// prevent a crash at empty waypoint path.
if (!i_path || i_path->empty())
{
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
return true;
}
} // HasDone == false
} // i_creature.IsStopped()