Skip to content

Commit 666371a

Browse files
authored
Fix crash in WaypointMovementGenerator. (vmangos#2938)
1 parent 2e47f97 commit 666371a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/game/Movement/WaypointMovementGenerator.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void WaypointMovementGenerator<Creature>::Reset(Creature &creature)
112112
if (m_isWandering)
113113
{
114114
// prevent a crash at empty waypoint path.
115-
if (!i_path || i_path->empty())
115+
if (!i_path || i_path->empty() || !m_lastReachedWaypoint)
116116
return;
117117

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

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

0 commit comments

Comments
 (0)