Fix farming unloaded node crash
authorShadowNinja <shadowninja@minetest.net>
Sun, 7 Sep 2014 00:34:52 +0000 (20:34 -0400)
committerShadowNinja <shadowninja@minetest.net>
Sun, 7 Sep 2014 00:36:40 +0000 (20:36 -0400)
mods/farming/api.lua

index e6d57f803fe0727bbe49642b63489c770669819c..6ce996d8138f86c14ee63bd1483ce413663f6248 100644 (file)
@@ -241,6 +241,9 @@ farming.register_plant = function(name, def)
                        if minetest.get_item_group(node.name, "seed") and node_def.fertility then
                                local can_grow = false
                                local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
+                               if not soil_node then
+                                       return
+                               end
                                for _, v in pairs(node_def.fertility) do
                                        if minetest.get_item_group(soil_node.name, v) ~= 0 then
                                                can_grow = true