Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Chests: Fix crash on empty key metadata
- Loading branch information
Showing
with
4 additions
and
0 deletions.
-
+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("") |
|
|