Fix possible crash with grass ABM.
authorNovatux <nathanael.courant@laposte.net>
Sat, 2 Nov 2013 15:13:07 +0000 (16:13 +0100)
committerPilzAdam <pilzadam@minetest.net>
Sat, 2 Nov 2013 15:22:26 +0000 (16:22 +0100)
games/minimal/mods/default/init.lua

index 4e6ad67bd3cb512fe3603e8092d8c6061a2aeef3..eae1fabcc390121b3819270498d51f9739a9b29c 100644 (file)
@@ -1618,7 +1618,9 @@ minetest.register_abm({
                local above = {x=pos.x, y=pos.y+1, z=pos.z}
                local name = minetest.get_node(above).name
                local nodedef = minetest.registered_nodes[name]
-               if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and nodedef.liquidtype == "none" and minetest.get_node_light(above) >= 13 then
+               if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
+                               and nodedef.liquidtype == "none"
+                               and (minetest.get_node_light(above) or 0) >= 13 then
                        if name == "default:snow" or name == "default:snowblock" then
                                minetest.set_node(pos, {name = "default:dirt_with_snow"})
                        else
@@ -1636,7 +1638,9 @@ minetest.register_abm({
                local above = {x=pos.x, y=pos.y+1, z=pos.z}
                local name = minetest.get_node(above).name
                local nodedef = minetest.registered_nodes[name]
-               if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") and nodedef.liquidtype == "none") then
+               if name ~= "ignore" and nodedef
+                               and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
+                               and nodedef.liquidtype == "none") then
                        minetest.set_node(pos, {name = "default:dirt"})
                end
        end