Skip to content

Commit

Permalink
Enforce that numbers aren't nan (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Aug 13, 2023
1 parent fa65cf0 commit dda39bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/src/nodes/properties/inputs/numeric_inputs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
from typing import List, Literal, Tuple, Union

import navi
Expand Down Expand Up @@ -99,6 +100,10 @@ def make_optional(self):

def enforce(self, value):
assert isinstance(value, (int, float))

if math.isnan(value):
raise ValueError("NaN is not a valid number")

return clampNumber(value, self.precision, self.minimum, self.maximum)


Expand Down

0 comments on commit dda39bc

Please sign in to comment.