Core/Maps: Fixed crash caused by using invalid coordinates
Closes #12532
This commit is contained in:
1 parent
c0eba6a127
commit
b43a46e449
1 file changed
+1
-1
@@ -2635,7 +2635,6 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
float destx, desty, destz;
|
||||
destx = pos.m_positionX + dist * std::cos(angle);
|
||||
desty = pos.m_positionY + dist * std::sin(angle);
|
||||
destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
|
||||
|
||||
// Prevent invalid coordinates here, position is unchanged
|
||||
if (!Trinity::IsValidMapCoord(destx, desty))
|
||||
@@ -2644,6 +2643,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
return;
|
||||
}
|
||||
|
||||
destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
|
||||
bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
|
||||
|
||||
// collision occured
|
||||
|
||||
Reference in new issue
Block a user