From 9e50f577a05aa8e31ff719cb67e7a17ee9221505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 17 Nov 2013 15:48:28 +0100 Subject: [PATCH] fixed index outside bounds of the array when 0 productions left closes #4137 --- OpenRA.Mods.RA/Player/ClassicProductionQueue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index 19f2a39fc7..32b9a4f875 100755 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -107,7 +107,7 @@ namespace OpenRA.Mods.RA .Where(p => p.Trait.Info.Produces.Contains(unit.Traits.Get().Queue)) .Where(p => p.Actor.Owner == self.Owner).ToArray(); - var speedModifier = Math.Min(selfsameBuildings.Count(), Info.BuildTimeSpeedReduction.Length) - 1; + var speedModifier = selfsameBuildings.Count().Clamp(1, Info.BuildTimeSpeedReduction.Length) - 1; time = (time * Info.BuildTimeSpeedReduction[speedModifier]) / 100; }