Core/Movement: Add some extra assertions to MotionMaster.

Port From (https://github.com/TrinityCore/TrinityCore/commit/792914fb518349ef270e6f769f343bbcd333b942)
This commit is contained in:
hondacrx
2021-11-15 22:12:20 -05:00
parent 81193e3e3a
commit ee8228582b
3 changed files with 8 additions and 4 deletions
@@ -234,7 +234,12 @@ namespace Game.Movement
{
int nodeCount = _path.Count; //! Number of nodes in path.
_endMapId = _path[nodeCount - 1].ContinentID; //! MapId of last node
_preloadTargetNode = (uint)nodeCount - 3;
if (nodeCount < 3)
_preloadTargetNode = 0;
else
_preloadTargetNode = (uint)nodeCount - 3;
_endGridX = _path[nodeCount - 1].Loc.X;
_endGridY = _path[nodeCount - 1].Loc.Y;
}