fix crash when storageIndex > 256

pull/4/head
cosmonaut 2023-03-21 15:31:59 -07:00
parent 3817a9e809
commit ca912a3b5a
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ namespace MoonTools.ECS
{
var storageIndex = ComponentTypeIndices.GetIndex<TComponent>();
// TODO: is there some way to avoid this null check?
if (storages[storageIndex] == null)
if (storageIndex >= storages.Length || storages[storageIndex] == null)
{
Register<TComponent>(storageIndex);
}