From ec36f798c53e6d77d249af00199a5aa944d8b9c8 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 3 Apr 2013 22:46:57 -0400 Subject: [PATCH] fixed an obscure bug where doors placed onto an unknown block would cause a crash. --- door_nodes.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/door_nodes.lua b/door_nodes.lua index 3ea264bb..5cfc6b7d 100644 --- a/door_nodes.lua +++ b/door_nodes.lua @@ -169,7 +169,8 @@ for i in ipairs(sides) do on_place = function(itemstack, placer, pointed_thing) local node=minetest.env:get_node(pointed_thing.under) - if not minetest.registered_nodes[node.name].on_rightclick then + if not minetest.registered_nodes[node.name] + or not minetest.registered_nodes[node.name].on_rightclick then return homedecor_place_door(itemstack, placer, pointed_thing, doorname, side) else minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) @@ -188,7 +189,9 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side) if homedecor_node_is_owned(pointed_thing.under, placer) == false then local nodename = minetest.env:get_node(pointed_thing.under).name - local field = minetest.registered_nodes[nodename].on_rightclick + local field = nil + + if minetest.registered_nodes[nodename] then field = minetest.registered_nodes[nodename].on_rightclick end if field == nil then fdir = minetest.dir_to_facedir(placer:get_look_dir())