summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJPG <jeanpatrick.guerrero@gmail.com>2016-12-16 14:35:53 +0100
committerJPG <jeanpatrick.guerrero@gmail.com>2016-12-16 14:41:07 +0100
commit997b3c59bb93f704975be0b189b62c87f84b3268 (patch)
tree062411e0c29a20fb1c9f61d887fc8c544aaaa587
parent128413ca04c9067810b5c80b9170882493419d42 (diff)
Fix nil crash on un{craft,fuel}able items in output
-rw-r--r--init.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 55e4d1e..5a4f215 100644
--- a/init.lua
+++ b/init.lua
@@ -1,3 +1,4 @@
+
local craftguide, datas = {}, {}
local progressive_mode = minetest.setting_getbool("craftguide_progressive_mode")
local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
@@ -281,6 +282,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
else for item in pairs(fields) do
if not item:find(":") then return end
if item:sub(-4) == "_inv" then item = item:sub(1,-5) end
+ local recipes = minetest.get_all_craft_recipes(item)
+ if not recipes then return end
if progressive_mode then
local _, player_has_item =
@@ -290,7 +293,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
data.item = item
data.recipe_num = 1
- data.recipes_item = minetest.get_all_craft_recipes(item)
+ data.recipes_item = recipes
craftguide:get_formspec(player_name)
end
end