From 4ee9d1e3dabc4bb777d02507724b95d8dddcc8b9 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Sun, 23 May 2021 06:42:33 -0600 Subject: [PATCH] Attempted to fix modified collection crash in waypoint collection loop --- SceneManager/Paths/Path.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SceneManager/Paths/Path.cs b/SceneManager/Paths/Path.cs index 14019fd..75fe11d 100644 --- a/SceneManager/Paths/Path.cs +++ b/SceneManager/Paths/Path.cs @@ -239,9 +239,9 @@ namespace SceneManager.Paths var collectorWaypoints = Waypoints.Where(x => x.IsCollector); var vehiclesInWorld = World.GetAllVehicles().Where(x => x); - foreach (Waypoint waypoint in collectorWaypoints) + foreach (Waypoint waypoint in collectorWaypoints.ToList()) { - foreach (Vehicle vehicle in vehiclesInWorld) + foreach (Vehicle vehicle in vehiclesInWorld.ToList()) { if (vehicle.IsNearCollectorWaypoint(waypoint) && vehicle.IsValidForPathCollection(this)) {