mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 02:42:25 +01:00
Add guard to prevent crash when converting old mobs and the minetest fails to create the new entity
This commit is contained in:
parent
8aa65f85f2
commit
bc343769ee
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user