fixed a rare NaN lua error

This commit is contained in:
Meow
2026-03-11 05:14:35 +01:00
parent c503635622
commit 313f01f191
+2 -1
View File
@@ -1391,6 +1391,7 @@ end
-- return r,g,b and hexcolor
local gradientcolors = {}
function pfUI.api.GetColorGradient(perc)
if not perc or perc ~= perc then perc = 0 end -- NaN guard: NaN ~= NaN is true in Lua
perc = perc > 1 and 1 or perc
perc = perc < 0 and 0 or perc
perc = floor(perc*100)/100
@@ -1508,4 +1509,4 @@ function pfUI.api.TryMemoizedFuncLoadstringForSpellCasts(funcOrStr)
end
return nil
end
end