mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[scene] Ensure entity owns component before removing
I realized I should check that the entity owns the component before treating it as existing when adding an existing component, then noticed that Ent_RemoveComponent didn't check before removing the component. I imagine that would have been a fun debug session :P
This commit is contained in:
parent
9e83ded0ac
commit
4759be449f
1 changed files with 1 additions and 1 deletions
|
@ -97,7 +97,7 @@ Ent_RemoveComponent (uint32_t ent, uint32_t comp, ecs_registry_t *registry)
|
|||
uint32_t id = Ent_Index (ent);
|
||||
ecs_pool_t *pool = ®istry->comp_pools[comp];
|
||||
uint32_t ind = pool->sparse[id];
|
||||
if (ind < pool->count) {
|
||||
if (ind < pool->count && pool->dense[ind] == ent) {
|
||||
uint32_t last = pool->count - 1;
|
||||
Component_DestroyElements (®istry->components[comp], pool->data,
|
||||
ind, 1);
|
||||
|
|
Loading…
Reference in a new issue