Skip to content

Commit

Permalink
Merge pull request #12 from EtherZa/infinite-loop
Browse files Browse the repository at this point in the history
Throw exception on double overflow to avoid infinite loop
  • Loading branch information
praeclarum authored Feb 1, 2025
2 parents b962c8d + c2d1c4c commit ab92ee0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Csg/Vector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public struct Vector3D : IEquatable<Vector3D>

public Vector3D(double x, double y, double z)
{
if (double.IsNaN(x)) throw new ArgumentOutOfRangeException (nameof(x), "Value is NaN");
if (double.IsNaN(y)) throw new ArgumentOutOfRangeException (nameof(y), "Value is NaN");
if (double.IsNaN(z)) throw new ArgumentOutOfRangeException (nameof(z), "Value is NaN");

X = x;
Y = y;
Z = z;
Expand Down

0 comments on commit ab92ee0

Please sign in to comment.