From 3104d9ed96901a0c0e11dd353fa2624949322a69 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 11 Dec 2015 01:55:34 -0600 Subject: Don't crash the server on a wrong message type --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 69a560f..530089b 100644 --- a/init.lua +++ b/init.lua @@ -25,13 +25,13 @@ function rgblightstone.add(name) local xaddr = minetest.get_meta(pos):get_string("addrx") local yaddr = minetest.get_meta(pos):get_string("addry") if channel==channel_set and msg ~= nil then - if xaddr ~= nil and xaddr ~= "" and yaddr ~= nil and yaddr ~= "" then + if xaddr ~= nil and xaddr ~= "" and yaddr ~= nil and yaddr ~= "" and type(msg) == "table" then for _,color in ipairs(rgblightstone.colors) do if msg[tonumber(yaddr)] ~= nil and msg[tonumber(yaddr)][tonumber(xaddr)] ~= nil and msg[tonumber(yaddr)][tonumber(xaddr)] == color and msg[tonumber(yaddr)][tonumber(xaddr)] ~= minetest.get_node(pos).color then minetest.swap_node(pos, {name = "rgblightstone:lightstone_"..color}) end end - else + elseif type(msg) == "string" then for _,color in ipairs(rgblightstone.colors) do if msg == color and msg ~= minetest.get_node(pos).color then minetest.swap_node(pos, {name = "rgblightstone:lightstone_"..color}) -- cgit v1.2.3