Prevent pathfinding crash (#8251)

This commit is contained in:
wrexbe
2022-05-17 21:40:27 -07:00
committed by GitHub
parent 7c36ffb6ef
commit 0993394fd8

View File

@@ -255,7 +255,7 @@ namespace Content.Server.AI.Pathfinding
// Which may or may not be intended?
if (entMan.TryGetComponent(entity, out AccessReaderComponent? accessReader) && !_accessReaders.ContainsKey(entity))
{
_accessReaders.Add(entity, accessReader);
_accessReaders.TryAdd(entity, accessReader);
ParentChunk.Dirty();
}
return;
@@ -265,11 +265,11 @@ namespace Content.Server.AI.Pathfinding
if (physicsComponent.BodyType != BodyType.Static)
{
_physicsLayers.Add(entity, physicsComponent.CollisionLayer);
_physicsLayers.TryAdd(entity, physicsComponent.CollisionLayer);
}
else
{
_blockedCollidables.Add(entity, physicsComponent.CollisionLayer);
_blockedCollidables.TryAdd(entity, physicsComponent.CollisionLayer);
GenerateMask();
ParentChunk.Dirty();
}