Chests: Check 'def' of node above chest to avoid crash

In 'chest_lid_obstructed(pos)' check for nil 'def' to avoid a crash caused by
an unknown node above the chest.
This commit is contained in:
paramat 2017-06-16 03:47:12 +01:00 committed by sfan5
parent 103af98864
commit da41caca66

@ -1786,10 +1786,11 @@ local function chest_lid_obstructed(pos)
local above = {x = pos.x, y = pos.y + 1, z = pos.z} local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local def = minetest.registered_nodes[minetest.get_node(above).name] local def = minetest.registered_nodes[minetest.get_node(above).name]
-- allow ladders, signs, wallmounted things and torches to not obstruct -- allow ladders, signs, wallmounted things and torches to not obstruct
if def.drawtype == "airlike" or if def and
(def.drawtype == "airlike" or
def.drawtype == "signlike" or def.drawtype == "signlike" or
def.drawtype == "torchlike" or def.drawtype == "torchlike" or
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
return false return false
end end
return true return true