From 0993394fd81b2f5f63810b2b24cc1b62926ea0e1 Mon Sep 17 00:00:00 2001 From: wrexbe <81056464+wrexbe@users.noreply.github.com> Date: Tue, 17 May 2022 21:40:27 -0700 Subject: [PATCH] Prevent pathfinding crash (#8251) --- Content.Server/AI/Pathfinding/PathfindingNode.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/AI/Pathfinding/PathfindingNode.cs b/Content.Server/AI/Pathfinding/PathfindingNode.cs index d99bdc3511..b11c809e07 100644 --- a/Content.Server/AI/Pathfinding/PathfindingNode.cs +++ b/Content.Server/AI/Pathfinding/PathfindingNode.cs @@ -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(); }