From 96011bc71816b5e9eb2cc6c86f009198dfb1146c Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Sat, 22 Jun 2013 15:43:58 -0400 Subject: Audit code for possible nil value indexing with unregistered nodes. --- mesecons_movestones/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mesecons_movestones') diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index 14d828b..4bf6dc5 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -92,9 +92,11 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { local direction = mesecon:get_movestone_direction(pos) if not direction then -- no mesecon power + --push only solid nodes local name = minetest.env:get_node(pos).name if name ~= "air" and name ~= "ignore" - and minetest.registered_nodes[name].liquidtype == "none" then + and ((not minetest.registered_nodes[name]) + or minetest.registered_nodes[name].liquidtype == "none") then mesecon:mvps_push(pos, self.lastdir, MOVESTONE_MAXIMUM_PUSH) end minetest.env:add_node(pos, {name="mesecons_movestones:movestone"}) @@ -176,9 +178,11 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { local direction = mesecon:get_movestone_direction(pos) if not direction then -- no mesecon power + --push only solid nodes local name = minetest.env:get_node(pos).name if name ~= "air" and name ~= "ignore" - and minetest.registered_nodes[name].liquidtype == "none" then + and ((not minetest.registered_nodes[name]) + or minetest.registered_nodes[name].liquidtype == "none") then mesecon:mvps_push(pos, self.lastdir, MOVESTONE_MAXIMUM_PUSH) --STICKY mesecon:mvps_pull_all(pos, self.lastdir) -- cgit v1.2.3