diff options
author | Anthony Zhang <azhang9@gmail.com> | 2013-06-22 15:43:58 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2013-06-22 15:43:58 -0400 |
commit | 96011bc71816b5e9eb2cc6c86f009198dfb1146c (patch) | |
tree | a3ded974dcfc8aca8f6b9837e5a4d571a84e680d /mesecons_movestones | |
parent | ec63bd3abfdca2a77b7945834a9b37f7533a4e27 (diff) | |
download | mesecons-96011bc71816b5e9eb2cc6c86f009198dfb1146c.tar mesecons-96011bc71816b5e9eb2cc6c86f009198dfb1146c.tar.gz mesecons-96011bc71816b5e9eb2cc6c86f009198dfb1146c.tar.bz2 mesecons-96011bc71816b5e9eb2cc6c86f009198dfb1146c.tar.xz mesecons-96011bc71816b5e9eb2cc6c86f009198dfb1146c.zip |
Audit code for possible nil value indexing with unregistered nodes.
Diffstat (limited to 'mesecons_movestones')
-rw-r--r-- | mesecons_movestones/init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
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) |