From 73a3dbd4f2dd4f524703198ea6c5fc3a020556ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Thu, 12 Sep 2024 16:28:07 +0200 Subject: [PATCH] added check for nil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- MA3 OSC FEEDBACK.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MA3 OSC FEEDBACK.lua b/MA3 OSC FEEDBACK.lua index fde36b7..95f0377 100644 --- a/MA3 OSC FEEDBACK.lua +++ b/MA3 OSC FEEDBACK.lua @@ -60,12 +60,15 @@ local function poll(exec_no) local execAssObj = execAssObjNoClass:GetClass() 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") if assObjApp then - local app_id = tonumber(assObjApp:gsub("Appearance ", "")) - local app_data = ShowData().Appearances[app_id] - colors = {tonumber(app_data.BackR), tonumber(app_data.BackG), tonumber(app_data.BackB)} + -- Make sure assObjApp is valid and then remove "Appearance " prefix + local app_id = tonumber(tostring(assObjApp):gsub("Appearance ", "")) + 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 -- Send colors through OSC