forked from thunderdog1138/star_wars
Chests: Fix crash on empty key metadata
This commit is contained in:
parent
382e2acd9b
commit
cf0e49fb4a
|
@ -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("")
|
||||
|
|
Loading…
Reference in New Issue