From: SmallJoker Date: Thu, 18 Oct 2018 04:45:35 +0000 (+0200) Subject: Chests: Fix crash on empty key metadata X-Git-Tag: 5.0.0~28 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cf0e49fb4aee91085011b0eb6cbb9e15c0d4614c;p=oweals%2Fminetest_game.git Chests: Fix crash on empty key metadata --- diff --git a/mods/default/chests.lua b/mods/default/chests.lua index cd707991..33389056 100644 --- a/mods/default/chests.lua +++ b/mods/default/chests.lua @@ -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("")