This commit is contained in:
CortexCore
2025-04-28 15:11:01 +08:00
parent 2d8978e694
commit f8bcf8a4d4
19 changed files with 526 additions and 15 deletions

View File

@@ -161,7 +161,17 @@ namespace BITKit.Entities
if (instances.TryGetValue(h0, out var v0) is false)
{
instances[h0] = v0 = _entitiesInternal[id].ServiceProvider.GetRequiredService<T>();
try
{
instances[h0] = v0 = _entitiesInternal[id].ServiceProvider.GetRequiredService<T>();
}
catch (KeyNotFoundException)
{
_logger.LogWarning($"Missing Entity {id},Ignore for now");
hashset.Remove(id);
break;
}
}
array[i] = Unsafe.As<T>(v0);

View File

@@ -39,7 +39,7 @@ namespace BITKit.Entities
public void Dispose()
{
_serviceProvider.Dispose();
_serviceProvider?.Dispose();
}
}
}