Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Chests: Fix crash on empty key metadata
  • Loading branch information
SmallJoker authored and paramat committed Oct 18, 2018
1 parent 382e2ac commit cf0e49f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mods/default/chests.lua
Expand Up @@ -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("")
Expand Down

0 comments on commit cf0e49f

Please sign in to comment.