diff --git a/Svelto.ECS/EntityViewsDB.cs b/Svelto.ECS/EntityViewsDB.cs index 2cabe48..5b10d92 100644 --- a/Svelto.ECS/EntityViewsDB.cs +++ b/Svelto.ECS/EntityViewsDB.cs @@ -39,8 +39,12 @@ namespace Svelto.ECS.Internal if (_groupEntityViewsDB.TryGetValue(group, out entitiesInGroupPerType) == false) return RetrieveEmptyEntityViewList(); + + ITypeSafeList outList; + if (entitiesInGroupPerType.TryGetValue(typeof(T), out outList) == false) + return RetrieveEmptyEntityViewList(); - return new FasterReadOnlyList((FasterList) entitiesInGroupPerType[typeof(T)]); + return new FasterReadOnlyList((FasterList) outList); } public T[] QueryEntityViewsAsArray(out int count) where T : IEntityView