mirror of
https://github.com/minetest-mods/technic.git
synced 2025-01-26 18:00:32 +01:00
Fix crash issue
This commit is contained in:
parent
3b70b56560
commit
da4f4f5e23
@ -121,22 +121,25 @@ function technic.get_recipe(typename, items)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local recipe = technic.recipes[typename].recipes[index]
|
local recipe = technic.recipes[typename].recipes[index]
|
||||||
if recipe then
|
if recipe then
|
||||||
local new_input = {}
|
local new_input = {}
|
||||||
for i, stack in ipairs(items) do
|
for i, stack in ipairs(items) do
|
||||||
if stack:get_count() < recipe.input[stack:get_name()] then
|
local input_count = recipe.input[stack:get_name()]
|
||||||
return nil
|
if input_count == nil then
|
||||||
else
|
-- Handle nil value, maybe return nil or log a warning
|
||||||
new_input[i] = ItemStack(stack)
|
return nil
|
||||||
new_input[i]:take_item(recipe.input[stack:get_name()])
|
end
|
||||||
end
|
if stack:get_count() < input_count then
|
||||||
end
|
return nil
|
||||||
return {time = recipe.time,
|
else
|
||||||
new_input = new_input,
|
new_input[i] = ItemStack(stack)
|
||||||
output = recipe.output}
|
new_input[i]:take_item(input_count)
|
||||||
else
|
end
|
||||||
return nil
|
end
|
||||||
end
|
return {time = recipe.time, new_input = new_input, output = recipe.output}
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user