From ca912a3b5a28aae711a92d7f95b26efedd124bb5 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 21 Mar 2023 15:31:59 -0700 Subject: [PATCH] fix crash when storageIndex > 256 --- src/ComponentDepot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }