Skip to content

Commit

Permalink
Fix double-revoke crash in Demolishable.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote authored and reaperrr committed Feb 3, 2019
1 parent a641ac0 commit 93cef02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions OpenRA.Mods.Common/Traits/Demolishable.cs
Expand Up @@ -45,6 +45,7 @@ public DemolishAction(Actor saboteur, int delay, int token)

ConditionManager conditionManager;
List<DemolishAction> actions = new List<DemolishAction>();
List<DemolishAction> removeActions = new List<DemolishAction>();

public Demolishable(DemolishableInfo info)
: base(info) { }
Expand Down Expand Up @@ -88,9 +89,18 @@ void ITick.Tick(Actor self)
if (Util.ApplyPercentageModifiers(100, modifiers) > 0)
self.Kill(a.Saboteur);
else if (a.Token != ConditionManager.InvalidConditionToken)
{
conditionManager.RevokeCondition(self, a.Token);
removeActions.Add(a);
}
}
}

// Remove expired actions to avoid double-revoking
foreach (var a in removeActions)
actions.Remove(a);

removeActions.Clear();
}
}
}

0 comments on commit 93cef02

Please sign in to comment.