Add nil check for clicker and item stack (#16)

This prevents crashes when on_rightclick is called by a mod.
This commit is contained in:
coil 2019-08-18 16:10:47 -04:00 committed by FaceDeer
parent 200feb25bb
commit a6fa5984e2

View File

@ -215,6 +215,9 @@ minetest.register_node("anvil:anvil", {
end, end,
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if not clicker or not itemstack then
return
end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local name = clicker:get_player_name() local name = clicker:get_player_name()