Prevent crashs in can_dig on nil-player.

This commit is contained in:
Tim 2016-07-31 01:42:11 +02:00
parent df84e62798
commit 436fdfac55
2 changed files with 6 additions and 5 deletions

View File

@ -61,9 +61,10 @@ minetest.register_node("inbox:empty", {
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local name = player and player:get_player_name()
local owner = meta:get_string("owner")
local inv = meta:get_inventory()
return player:get_player_name() == owner and inv:is_empty("main")
return player == owner and inv:is_empty("main")
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)

View File

@ -141,9 +141,9 @@ minetest.register_node("itemframes:frame",{
end
end,
can_dig = function(pos,player)
local name = player and player:get_player_name()
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
return name == meta:get_string("owner")
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
@ -198,9 +198,9 @@ minetest.register_node("itemframes:pedestal",{
end
end,
can_dig = function(pos,player)
local name = player and player:get_player_name()
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
return name == meta:get_string("owner")
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)