From d2ffabdfd4347974d5ae7e44279dd5959a09fcd6 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Wed, 27 Oct 2021 01:28:38 +0200 Subject: [PATCH] Fix ChangeEntity collection modified exception. --- Content.Server/Construction/ConstructionSystem.Graph.cs | 3 ++- Resources/Changelog/Parts/duple.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Resources/Changelog/Parts/duple.yml diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index e6497b1116..ba69e5300f 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -206,8 +206,9 @@ namespace Content.Server.Construction // NOTE: Only Container is supported by Construction! var otherContainer = _containerSystem.EnsureContainer(newUid, container, newContainerManager); - foreach (var entity in ourContainer.ContainedEntities) + for (var i = ourContainer.ContainedEntities.Count - 1; i >= 0; i--) { + var entity = ourContainer.ContainedEntities[i]; ourContainer.ForceRemove(entity); otherContainer.Insert(entity); } diff --git a/Resources/Changelog/Parts/duple.yml b/Resources/Changelog/Parts/duple.yml new file mode 100644 index 0000000000..848bb24992 --- /dev/null +++ b/Resources/Changelog/Parts/duple.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Fix # One of the following: Add, Remove, Tweak, Fix + message: Fix computer dupe bug.