mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Add a few guards
This commit is contained in:
parent
f4ce399c23
commit
7990f94a06
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue