Chests: Fix crash on empty key metadata

This commit is contained in:
SmallJoker 2018-10-18 06:45:35 +02:00 committed by Paramat
parent 382e2acd9b
commit cf0e49fb4a

@ -147,6 +147,10 @@ function default.chest.register_chest(name, d)
local itemstack = player:get_wielded_item()
local key_meta = itemstack:get_meta()
if itemstack:get_metadata() == "" then
return
end
if key_meta:get_string("secret") == "" then
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
itemstack:set_metadata("")