Bucket: Prevent crashing when placing liquid against a buildable node into an unknown...
authorTim <t4im@users.noreply.github.com>
Tue, 5 Jul 2016 17:30:33 +0000 (19:30 +0200)
committerparamat <mat.gregory@virginmedia.com>
Thu, 7 Jul 2016 18:21:46 +0000 (19:21 +0100)
mods/bucket/init.lua

index 2d2690feaf338afdd9e9153ba65464d06b9a7997..521a4463d51aa6e9514ffd8d0d302616bc671fac 100644 (file)
@@ -88,10 +88,11 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
                                        -- check if the node above can be replaced
                                        lpos = pointed_thing.above
                                        local node = minetest.get_node_or_nil(lpos)
-                                       if not node
-                                       or not minetest.registered_nodes[node.name].buildable_to then
+                                       local above_ndef = node and minetest.registered_nodes[node.name]
+
+                                       if not above_ndef or not above_ndef.buildable_to then
                                                -- do not remove the bucket with the liquid
-                                               return
+                                               return itemstack
                                        end
                                end