Fix flammable item entities crashing

* backported from https://github.com/minetest/minetest_game/pull/2659
* fix to close https://codeberg.org/minenux/minetest-game-minetest/issues/11
This commit is contained in:
mckaygerhard 2022-04-14 20:45:16 -04:00
parent b1440d887d
commit 574d6cc65c

View File

@ -15,8 +15,8 @@ local item = {
burn_up = function(self) burn_up = function(self)
-- disappear in a smoke puff -- disappear in a smoke puff
self.object:remove()
local p = self.object:getpos() local p = self.object:getpos()
self.object:remove()
minetest.sound_play("default_item_smoke", { minetest.sound_play("default_item_smoke", {
pos = p, pos = p,
max_hear_distance = 8, max_hear_distance = 8,
@ -48,6 +48,10 @@ local item = {
if self.ignite_timer > 10 then if self.ignite_timer > 10 then
self.ignite_timer = 0 self.ignite_timer = 0
local pos = self.object:get_pos()
if pos == nil then
return -- object already deleted
end
local node = minetest.get_node_or_nil(self.object:getpos()) local node = minetest.get_node_or_nil(self.object:getpos())
if not node then if not node then
return return