Do not crash when a skeleton key is used on an unknown node (#2806)

This commit is contained in:
Montandalar 2021-01-16 03:43:19 +11:00 committed by GitHub
parent 1ade8941b4
commit 87f6b941c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -160,7 +160,8 @@ minetest.register_craftitem("default:skeleton_key", {
return itemstack
end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
local node_reg = minetest.registered_nodes[node.name]
local on_skeleton_key_use = node_reg and node_reg.on_skeleton_key_use
if not on_skeleton_key_use then
return itemstack
end