diff options
author | y.st <git@y.st> | 2015-06-14 22:51:40 -0700 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-06-15 17:41:25 +0200 |
commit | 3b4408aa6cb720fe8c5adaf46232cc5638d0a11b (patch) | |
tree | a4650f449d559af1311e6d093d5fcbec9a226b7a /games/minimal/mods | |
parent | 38482d26563d8ad4680dd018266eb5dccb2a5874 (diff) | |
download | minetest-3b4408aa6cb720fe8c5adaf46232cc5638d0a11b.tar.gz minetest-3b4408aa6cb720fe8c5adaf46232cc5638d0a11b.tar.bz2 minetest-3b4408aa6cb720fe8c5adaf46232cc5638d0a11b.zip |
Don't crash when saplings try to grow on unknown nodes
Diffstat (limited to 'games/minimal/mods')
-rw-r--r-- | games/minimal/mods/default/init.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 120f004b7..cf0a1c679 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1660,7 +1660,12 @@ minetest.register_abm({ interval = 10, chance = 50, action = function(pos, node) - local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil + local node_under = minetest.registered_nodes[ + minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name] + if not node_under then + return + end + local is_soil = node_under.groups.soil if is_soil == nil or is_soil == 0 then return end print("A sapling grows into a tree at "..minetest.pos_to_string(pos)) local vm = minetest.get_voxel_manip() |