From 2dd4db0c890292a8304d37ac730a60033ded0f67 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 13 Jan 2017 00:53:26 -0600 Subject: Fix crash when two controllers are connected --- fw.lua | 10 ++++++++++ init.lua | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fw.lua b/fw.lua index 6a04ac5..54aa933 100644 --- a/fw.lua +++ b/fw.lua @@ -15,6 +15,16 @@ modes = {"Sensor","Timer","Phase Lock"} panellock = {"Unlocked","Locked"} logmodes = {"Quiet","Normal","Verbose"} +--Only accept digilines signals on the necessary channels +local event_ok = false +if event.type ~= "digiline" then event_ok = true end +if (not event_ok) and (string.find(event.channel,"detector") or string.find(event.channel,"preempt")) then event_ok = true end +if (not event_ok) and (event.channel == "touchscreen") then event_ok = true end +if not event_ok then + --Digilines signal on unimportant channel, stop execution + return +end + --Used for reverse lookups function pivot(table) local out = {} diff --git a/init.lua b/init.lua index 7506b83..d0b63cf 100644 --- a/init.lua +++ b/init.lua @@ -528,7 +528,7 @@ minetest.register_lbm({ action = function(pos) local meta = minetest.get_meta(pos) local mem = minetest.deserialize(meta:get_string("mem")) - if mem.cycle then + if mem and mem.cycle then local event = {} event.type = "interrupt" event.iid = "tick" -- cgit v1.2.3