Skip to content

Commit

Permalink
Fix crash in WaypointMovementGenerator. (#2938)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wall-core authored Mar 3, 2025
1 parent 2e47f97 commit 666371a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game/Movement/WaypointMovementGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void WaypointMovementGenerator<Creature>::Reset(Creature &creature)
if (m_isWandering)
{
// prevent a crash at empty waypoint path.
if (!i_path || i_path->empty())
if (!i_path || i_path->empty() || !m_lastReachedWaypoint)
return;

const WaypointNode& node = i_path->at(m_lastReachedWaypoint);
Expand Down Expand Up @@ -292,7 +292,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, uint32 cons
bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x, float& y, float& z)
{
// prevent a crash at empty waypoint path.
if (!i_path || i_path->empty())
if (!i_path || i_path->empty() || !m_lastReachedWaypoint)
return false;

const WaypointNode& node = i_path->at(m_lastReachedWaypoint);
Expand Down

0 comments on commit 666371a

Please sign in to comment.