diff --git a/src/ComponentDepot.cs b/src/ComponentDepot.cs index 6f746fa..b93300d 100644 --- a/src/ComponentDepot.cs +++ b/src/ComponentDepot.cs @@ -31,7 +31,7 @@ namespace MoonTools.ECS { var storageIndex = ComponentTypeIndices.GetIndex(); // TODO: is there some way to avoid this null check? - if (storages[storageIndex] == null) + if (storageIndex >= storages.Length || storages[storageIndex] == null) { Register(storageIndex); }