diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-26 13:58:47 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-26 13:58:47 -0400 |
| commit | 10b533841de5c0e0b49a2f8a6cf1c53117cf78fc (patch) | |
| tree | eded198e7f0e20741aee278d9af33180953bd9e4 /src | |
| parent | 3e7850ca30e8b0a8cc788df60cf988cafce4150e (diff) | |
check instance count before returning a pointer to an instance
Diffstat (limited to 'src')
| -rw-r--r-- | src/ecs.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ecs.cpp b/src/ecs.cpp index 1fae912..f5c5e72 100644 --- a/src/ecs.cpp +++ b/src/ecs.cpp @@ -224,6 +224,8 @@ CompInstance *ECS_GetInstance(EntityHandle entHandle) { auto i = Buckets_GetItemIndex(instanceHandle_t); auto &comp = Comp_Instance_BucketContainer.buckets[b].instances[i]; + if (comp.index >= grBinds.instances.Count()) + return nullptr; comp.ptr = &grBinds.instances[comp.index]; return ∁ } |
