add nil check for mob eggs

This commit is contained in:
TenPlus1 2020-05-08 20:33:41 +01:00
parent f32b69a654
commit f576947d41
1 changed files with 2 additions and 2 deletions

View File

@ -3972,7 +3972,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
local data = itemstack:get_metadata()
local mob = minetest.add_entity(pos, mob, data)
local ent = mob:get_luaentity()
local ent = mob and mob:get_luaentity()
if not ent then return end -- sanity check
@ -4020,7 +4020,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
pos.y = pos.y + 1
local mob = minetest.add_entity(pos, mob)
local ent = mob:get_luaentity()
local ent = mob and mob:get_luaentity()
if not ent then return end -- sanity check