diff --git a/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs index e8470bff1e..2901b72457 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/AiSystem.cs @@ -68,11 +68,23 @@ namespace Content.Server.GameObjects.EntitySystems.AI } _queuedSleepMessages.Clear(); + var toRemove = new List(); foreach (var processor in _awakeAi) { + if (processor.SelfEntity.Deleted) + { + toRemove.Add(processor); + continue; + } + processor.Update(frameTime); } + + foreach (var processor in toRemove) + { + _awakeAi.Remove(processor); + } } private void HandleAiSleep(SleepAiMessage message)