From fae433d5386b14397cd614867d0a723c0fef9099 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sat, 6 Jan 2018 14:12:40 -0500 Subject: [PATCH] touch: initialize color table correctly Failing this, it was possible to call into a drawing without a primary color assigned, which could lead to any number of crashes. --- lamp-touch.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lamp-touch.lua b/lamp-touch.lua index 97bef83..84b66a7 100644 --- a/lamp-touch.lua +++ b/lamp-touch.lua @@ -10,9 +10,9 @@ local touch_db_blackout = nil local touch_db_fn = nil local touchfns = { } local touchfnix = 1 -local colors = { } local cccb = nil local ncolors = 1 +-- colors table initialized below, once we have touchcolorvec in scope if touchcolor == nil then touchcolor = 40 end if touchlastfn == nil then touchlastfn = "fill" end @@ -80,6 +80,8 @@ local function touchcolorvec(c) return g,r,b end +local colors = { string.char(touchcolorvec(touchcolor)) } + local function onblackdebounce() touch_db_blackout = nil end local function onfndebounce() touch_db_fn = nil end -- 2.50.1