Fix some rare cases where the player is null and dig the itemframe or mailbox

This commit is contained in:
kilbith 2015-09-24 23:01:16 +02:00
parent 64c26e2d25
commit cca951e0e6
2 changed files with 7 additions and 3 deletions

View File

@ -119,7 +119,10 @@ xdecor.register("frame", {
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
local owner = meta:get_string("owner")
if not player or player:get_player_name() ~= owner then return false end
return true
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)

View File

@ -36,8 +36,9 @@ xdecor.register("mailbox", {
local owner = meta:get_string("owner")
local inv = meta:get_inventory()
if not inv:is_empty("main") then return false end
return player:get_player_name() == owner
if not inv:is_empty("main") or not player or
player:get_player_name() ~= owner then return false end
return true
end,
on_metadata_inventory_put = function(pos, listname, _, stack, _)
local inv = minetest.get_meta(pos):get_inventory()