1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

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

View File

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