Skip to content

Commit

Permalink
Merge pull request #170 from dnqbob/fix-sharedcrash
Browse files Browse the repository at this point in the history
Fix possible crash in SharedCargoManager
  • Loading branch information
MustaphaTR authored Oct 23, 2024
2 parents 2588691 + b6205c3 commit daf9a0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OpenRA.Mods.AS/Traits/Player/SharedCargoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ public SharedCargoManager(SharedCargoManagerInfo info)

public void Clear(AttackInfo e = null)
{
foreach (var passenger in Cargo)
for (var i = 0; i < Cargo.Count; i++)
{
var passenger = Cargo[i];
if (e != null)
passenger.Kill(e.Attacker, e.Damage.DamageTypes);
else
passenger.Dispose();
}

Cargo.Clear();
TotalWeight = 0;
Expand Down

0 comments on commit daf9a0b

Please sign in to comment.