Quantcast

* Guarded the ColorGradient() function against specific odd cases

James Whitehead II [04-06-08 - 07:50]
* Guarded the ColorGradient() function against specific odd cases
Filename
TomTom_CrazyArrow.lua
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index e5953aa..f3a1f64 100644
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -52,9 +52,13 @@ local function ColorGradient(perc, ...)
 	r1, g1, b1 = select((segment*3)+1, ...), select((segment*3)+2, ...), select((segment*3)+3, ...)
 	r2, g2, b2 = select((segment*3)+4, ...), select((segment*3)+5, ...), select((segment*3)+6, ...)

-	return r1 + (r2-r1)*relperc,
-	g1 + (g2-g1)*relperc,
-	b1 + (b2-b1)*relperc
+	if not r2 or not g2 or not b2 then
+		return r1, g1, b1
+	else
+		return r1 + (r2-r1)*relperc,
+		g1 + (g2-g1)*relperc,
+		b1 + (b2-b1)*relperc
+	end
 end

 local twopi = math.pi * 2