Add a few guards

This commit is contained in:
Ukendio 2024-07-02 18:52:18 +02:00
parent f4ce399c23
commit 7990f94a06

View file

@ -452,10 +452,14 @@ end
function World.clear(world: World, entityId: i53) function World.clear(world: World, entityId: i53)
--TODO: use sparse_get (stashed) --TODO: use sparse_get (stashed)
local record = world.entityIndex.sparse[entityId] local record = world.entityIndex.sparse[entityId]
if not record then
local ROOT_ARCHETYPE = world.ROOT_ARCHETYPE return
end
if record.archetype == nil or record.archetype == ROOT_ARCHETYPE then local ROOT_ARCHETYPE = world.ROOT_ARCHETYPE
local archetype = record.archetype
if archetype == nil or archetype == ROOT_ARCHETYPE then
return return
end end