Skip to content
Permalink
Browse files

Chests: Fix crash on empty key metadata

  • Loading branch information...
SmallJoker authored and paramat committed Oct 18, 2018
1 parent 382e2ac commit cf0e49fb4aee91085011b0eb6cbb9e15c0d4614c
Showing with 4 additions and 0 deletions.
  1. +4 −0 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("")

0 comments on commit cf0e49f

Please sign in to comment.
You can’t perform that action at this time.