Fix nil error when accessing brasier inventory (#7)
Some checks failed
luacheck / luacheck (push) Has been cancelled

When node timers are not deleted by a map operation, the inventory might
no longer be present. This properly skips further logic such cases.
This commit is contained in:
Niklp 2023-11-19 19:32:08 +01:00 committed by GitHub
parent d520cd4cf3
commit 699a379acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,8 @@ local brasier_burn = function(pos)
if timer:is_started() and node_above.name == "fire:permanent_flame" then return end if timer:is_started() and node_above.name == "fire:permanent_flame" then return end
local inv = minetest.get_inventory({type="node", pos=pos}) local inv = minetest.get_inventory({type="node", pos=pos})
if not inv then return end -- Stop nodetimer
local item = inv:get_stack("fuel", 1) local item = inv:get_stack("fuel", 1)
local fuel_burned = minetest.get_craft_result({method="fuel", width=1, items={item:peek_item(1)}}).time local fuel_burned = minetest.get_craft_result({method="fuel", width=1, items={item:peek_item(1)}}).time