Skip to content

Commit

Permalink
Avoid a crash if subjects is empty.
Browse files Browse the repository at this point in the history
This can happen in the rare instance that the last
actor in the selection is killed in the same tick
that the OG is activated, and GetCursor is called
before the next tick cancels the OG.
  • Loading branch information
pchote authored and obrakmann committed Nov 20, 2018
1 parent 23f69bc commit 987b236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/AttackMove.cs
Expand Up @@ -175,7 +175,7 @@ public override string GetCursor(World world, CPos cell, int2 worldPixel, MouseI
{
var prefix = mi.Modifiers.HasModifier(Modifiers.Ctrl) ? "assaultmove" : "attackmove";

if (world.Map.Contains(cell))
if (world.Map.Contains(cell) && subjects.Any())
{
var explored = subjects.First().Actor.Owner.Shroud.IsExplored(cell);
var blocked = !explored && subjects.Any(a => !a.Trait.Info.MoveIntoShroud);
Expand Down

0 comments on commit 987b236

Please sign in to comment.