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:
parent
200feb25bb
commit
a6fa5984e2
3
init.lua
3
init.lua
@ -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()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user