diff options
author | cheapie <no-email-for-you@example.com> | 2015-12-11 01:55:34 -0600 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2015-12-11 01:55:34 -0600 |
commit | 3104d9ed96901a0c0e11dd353fa2624949322a69 (patch) | |
tree | b41642ca3e2c13a5d81a32a9731b799211e6904a | |
parent | ee6e27219e8aa9d4d8981ab0a952e3b0595f3948 (diff) | |
download | rgblightstone-3104d9ed96901a0c0e11dd353fa2624949322a69.tar rgblightstone-3104d9ed96901a0c0e11dd353fa2624949322a69.tar.gz rgblightstone-3104d9ed96901a0c0e11dd353fa2624949322a69.tar.bz2 rgblightstone-3104d9ed96901a0c0e11dd353fa2624949322a69.tar.xz rgblightstone-3104d9ed96901a0c0e11dd353fa2624949322a69.zip |
Don't crash the server on a wrong message type
-rw-r--r-- | init.lua | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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}) |