Skip to content

Commit

Permalink
Chests: Check 'def' of node above chest to avoid crash
Browse files Browse the repository at this point in the history
In 'chest_lid_obstructed(pos)' check for nil 'def' to avoid a crash caused by
an unknown node above the chest.
  • Loading branch information
paramat committed Jun 16, 2017
1 parent 502720b commit 120e969
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mods/default/nodes.lua
Expand Up @@ -1783,13 +1783,14 @@ local function get_chest_formspec(pos)
end
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]
-- 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 == "torchlike" or
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
return false
end
return true
Expand Down

0 comments on commit 120e969

Please sign in to comment.