mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-21 23:26:56 +00:00
fixed a rare NaN lua error
This commit is contained in:
+2
-1
@@ -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
|
||||
Reference in New Issue
Block a user