From bc343769ee8d3753c5af6b63ec81930f3f9eccf4 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 9 Jun 2024 08:38:47 -0500 Subject: [PATCH] Add guard to prevent crash when converting old mobs and the minetest fails to create the new entity --- mods/ENTITIES/mcl_mobs/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 44eae7b13..752eb7b4b 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -346,8 +346,10 @@ function mcl_mobs.register_conversion(old_name, new_name) minetest.register_entity(old_name, { on_activate = function(self, staticdata, dtime) local obj = minetest.add_entity(self.object:get_pos(), new_name, staticdata) - local hook = (obj:get_luaentity() or {})._on_after_convert - if hook then hook(obj) end + if obj then + local hook = (obj:get_luaentity() or {})._on_after_convert + if hook then hook(obj) end + end self.object:remove() end, _convert_to = new_name,