forked from minetest/minetest_game
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 itemstack = player:get_wielded_item()
|
||||||
local key_meta = itemstack:get_meta()
|
local key_meta = itemstack:get_meta()
|
||||||
|
|
||||||
|
if itemstack:get_metadata() == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if key_meta:get_string("secret") == "" then
|
if key_meta:get_string("secret") == "" then
|
||||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
||||||
itemstack:set_metadata("")
|
itemstack:set_metadata("")
|
||||||
|
Loading…
Reference in New Issue
Block a user