From: sfan5 Date: Fri, 24 Apr 2020 19:12:40 +0000 (+0200) Subject: Fix flammable item entities crashing (#2659) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=33eb7cee2a548dba89a6aed6ec7c9d093de4ff2f;p=oweals%2Fminetest_game.git Fix flammable item entities crashing (#2659) --- diff --git a/mods/default/item_entity.lua b/mods/default/item_entity.lua index 8da3ee68..d9bf7b19 100644 --- a/mods/default/item_entity.lua +++ b/mods/default/item_entity.lua @@ -15,8 +15,8 @@ local item = { burn_up = function(self) -- disappear in a smoke puff - self.object:remove() local p = self.object:get_pos() + self.object:remove() minetest.sound_play("default_item_smoke", { pos = p, max_hear_distance = 8, @@ -43,12 +43,16 @@ local item = { builtin_item.on_step(self, dtime, ...) if self.flammable then - -- flammable, check for igniters + -- flammable, check for igniters every 10 s self.ignite_timer = (self.ignite_timer or 0) + dtime if self.ignite_timer > 10 then self.ignite_timer = 0 - local node = minetest.get_node_or_nil(self.object:get_pos()) + local pos = self.object:get_pos() + if pos == nil then + return -- object already deleted + end + local node = minetest.get_node_or_nil(pos) if not node then return end