mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +00:00
fixed a rare NaN lua error
This commit is contained in:
@@ -1391,6 +1391,7 @@ end
|
|||||||
-- return r,g,b and hexcolor
|
-- return r,g,b and hexcolor
|
||||||
local gradientcolors = {}
|
local gradientcolors = {}
|
||||||
function pfUI.api.GetColorGradient(perc)
|
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 > 1 and 1 or perc
|
||||||
perc = perc < 0 and 0 or perc
|
perc = perc < 0 and 0 or perc
|
||||||
perc = floor(perc*100)/100
|
perc = floor(perc*100)/100
|
||||||
|
|||||||
Reference in New Issue
Block a user