From 570b6832addf04c245477de6904bc823e3f156ad Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Sun, 22 Dec 2019 12:00:59 -0800 Subject: [PATCH] check entity in store before remove component --- encompass-cs/ComponentBitSet.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/encompass-cs/ComponentBitSet.cs b/encompass-cs/ComponentBitSet.cs index 7ec25f4..3b40794 100644 --- a/encompass-cs/ComponentBitSet.cs +++ b/encompass-cs/ComponentBitSet.cs @@ -52,7 +52,10 @@ namespace Encompass public void RemoveComponent(Entity entity) where TComponent : struct, IComponent { - entities[entity].Set(TypeToIndex[typeof(TComponent)], false); + if (entities.ContainsKey(entity)) + { + entities[entity].Set(TypeToIndex[typeof(TComponent)], false); + } } public void RemoveEntity(Entity entity)