Merge pull request 'Add secondary existence check after main logic has been executed to prevent future crashes' (#1657) from jordan4ibanez/MineClone2:mineclone5 into mineclone5

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1657
This commit is contained in:
jordan4ibanez 2021-04-25 20:12:34 +00:00
commit c40011b566
2 changed files with 7 additions and 0 deletions

View file

@ -1101,6 +1101,12 @@ mobs.mob_step = function(self, dtime)
end end
end end
--do not continue if non-existent
if not self or not self.object or not self.object:get_luaentity() then
self.object:remove()
return false
end
-- can mob be pushed, if so calculate direction -- do this last (overrides everything) -- can mob be pushed, if so calculate direction -- do this last (overrides everything)
if self.pushable then if self.pushable then

View file

@ -378,3 +378,4 @@ mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0) mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0)