Fix a crash with support powers and units without selection decorations
This commit is contained in:
@@ -192,8 +192,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
|
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
|
||||||
{
|
{
|
||||||
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
||||||
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
if (decorations != null)
|
||||||
yield return d;
|
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
||||||
|
yield return d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,8 +319,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
|
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
|
||||||
{
|
{
|
||||||
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
||||||
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
if (decorations != null)
|
||||||
yield return d;
|
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
||||||
|
yield return d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,8 +155,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var unit in power.UnitsInRange(xy))
|
foreach (var unit in power.UnitsInRange(xy))
|
||||||
{
|
{
|
||||||
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
var decorations = unit.TraitsImplementing<ISelectionDecorations>().FirstEnabledTraitOrDefault();
|
||||||
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
if (decorations != null)
|
||||||
yield return d;
|
foreach (var d in decorations.RenderSelectionAnnotations(unit, wr, Color.Red))
|
||||||
|
yield return d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user