Check that the received message is a string before doing anything with it

master
Pedro Gimeno 2017-12-21 11:34:59 +01:00
parent 864e158d3c
commit 56466a704e
1 changed files with 2 additions and 3 deletions

View File

@ -32,10 +32,9 @@ end
local function multicolour_light_effector_action(pos, node, channel, msg)
local configured_channel = minetest.get_meta(pos):get_string("digich")
if channel == configured_channel then
-- quick test
if channel == configured_channel and type(msg) == "string" then
local node = minetest.get_node(pos)
local onoff,colour = msg:match("^([^#]+)#?(%x-)$")
local onoff, colour = msg:match("^([^#]+)#?(%x-)$")
if onoff == "off" and node.name == "digiplay:multicolour_light_on" then
node.name = "digiplay:multicolour_light"
elseif onoff == "on" and node.name == "digiplay:multicolour_light" then