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.
This commit is contained in:
RoosterDragon
2022-04-22 21:42:31 +01:00
committed by Matthias Mailänder
parent 7df39f3522
commit 3e5666ca53

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
var sourcesList = sources.ToList(); var sourcesList = sources.ToList();
if (sourcesList.Count == 0) if (sourcesList.Count == 0)
throw new ArgumentException($"{nameof(sources)} must not be empty.", nameof(sources)); return NoPath;
var locomotor = GetLocomotor(self); var locomotor = GetLocomotor(self);