From 3e5666ca5358532edead3088ca18b8def52ad4b5 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Fri, 22 Apr 2022 21:42:31 +0100 Subject: [PATCH] Return an empty path when a search with no locations is made. The restores the previous behaviour before FindUnitPathToTargetCell was introduced. This prevents callers such as the harvester code crashing when a harvester tries to route home to a refinery, but there are no refineries. --- OpenRA.Mods.Common/Traits/World/PathFinder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/World/PathFinder.cs b/OpenRA.Mods.Common/Traits/World/PathFinder.cs index 435d070ba3..c9f9e39888 100644 --- a/OpenRA.Mods.Common/Traits/World/PathFinder.cs +++ b/OpenRA.Mods.Common/Traits/World/PathFinder.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits { var sourcesList = sources.ToList(); if (sourcesList.Count == 0) - throw new ArgumentException($"{nameof(sources)} must not be empty.", nameof(sources)); + return NoPath; var locomotor = GetLocomotor(self);