From cf0e49fb4aee91085011b0eb6cbb9e15c0d4614c Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Thu, 18 Oct 2018 06:45:35 +0200 Subject: [PATCH] Chests: Fix crash on empty key metadata --- mods/default/chests.lua | 4 ++++ 1 file changed, 4 insertions(+) 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("") -- 2.25.1