Skip to content

Commit

Permalink
Safeguard actor positions
Browse files Browse the repository at this point in the history
  • Loading branch information
Exouxas committed Oct 14, 2023
1 parent 4997c81 commit f3b4db1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/Worlds/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ public Vector3 GetPosition(Actor a)
/// <param name="v">The location the actor will be moved to</param>
public void MoveTo(Actor a, Vector3 v)
{
if (float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z))
{
throw new ArgumentException("Vector3 cannot contain NaN values");
}

Vector3 oldPosition = GetPosition(a);

lock (_positionsLock)
Expand Down

0 comments on commit f3b4db1

Please sign in to comment.