added check for nil
Signed-off-by: Ebbe Baß <ebbe.bass>
This commit is contained in:
@@ -60,12 +60,15 @@ local function poll(exec_no)
|
|||||||
local execAssObj = execAssObjNoClass:GetClass()
|
local execAssObj = execAssObjNoClass:GetClass()
|
||||||
local colors = color_map[execAssObj] or {0, 0, 0} -- fallback colors
|
local colors = color_map[execAssObj] or {0, 0, 0} -- fallback colors
|
||||||
|
|
||||||
-- Appearance-based color override
|
-- Check if assObjApp exists before using gsub
|
||||||
local assObjApp = execAssObjNoClass:Get("Appearance")
|
local assObjApp = execAssObjNoClass:Get("Appearance")
|
||||||
if assObjApp then
|
if assObjApp then
|
||||||
local app_id = tonumber(assObjApp:gsub("Appearance ", ""))
|
-- Make sure assObjApp is valid and then remove "Appearance " prefix
|
||||||
local app_data = ShowData().Appearances[app_id]
|
local app_id = tonumber(tostring(assObjApp):gsub("Appearance ", ""))
|
||||||
colors = {tonumber(app_data.BackR), tonumber(app_data.BackG), tonumber(app_data.BackB)}
|
if app_id and ShowData().Appearances[app_id] then
|
||||||
|
local app_data = ShowData().Appearances[app_id]
|
||||||
|
colors = {tonumber(app_data.BackR), tonumber(app_data.BackG), tonumber(app_data.BackB)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send colors through OSC
|
-- Send colors through OSC
|
||||||
|
|||||||
Reference in New Issue
Block a user