Core/MovementGenerator: Fix crash in taxi paths

Fix a crash in taxi paths happening when joining a battleground/dungeon while on a taxi path after second last node but close to last node, then leaving/finishing the battleground.
This commit is contained in:
Giacomo Pozzoni
2019-09-17 15:56:42 +02:00
committed by Ovahlord
parent ba3084d1a4
commit 2bacebe93b

View File

@@ -152,8 +152,8 @@ void FlightPathMovementGenerator::DoReset(Player* player)
bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
{
uint32 pointId = (uint32)player->movespline->currentPathIdx();
if (pointId > _currentNode)
uint32 pointId = player->movespline->currentPathIdx() < 0 ? 0 : player->movespline->currentPathIdx();
if (pointId > _currentNode && _currentNode < _path.size())
{
bool departureEvent = true;
do
@@ -170,7 +170,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
}
}
if (pointId == _currentNode)
if (pointId >= _currentNode)
break;
if (_currentNode == _preloadTargetNode)