diff options
author | Wuzzy <almikes@aol.com> | 2016-12-03 21:11:55 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-12-03 21:11:55 +0100 |
commit | 7f40f3404a8f9a53d01449296e37665d13223f52 (patch) | |
tree | c248d1f0c6e02b62d00cf78428ba32c24658e9f8 /init.lua | |
parent | 094f13607ad3a21ab5da5eee257304b128ee05d9 (diff) |
Gracefully fail when trying to parse unknown item
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -104,6 +104,11 @@ end -- Extract suitable item description for formspec local description_for_formspec = function(itemstring) + if minetest.registered_items[itemstring] == nil then + -- Huh? The item doesn't exist for some reason. Better give a dummy string + minetest.log("warning", "[doc] Unknown item detected: "..tostring(itemstring)) + return S("Unknown item (@1)", tostring(itemstring)) + end local description = minetest.registered_items[itemstring].description if description == nil or description == "" then return minetest.formspec_escape(itemstring) |