Skip to content

Commit

Permalink
Fix an exception during connecting to depot with more complex ships
Browse files Browse the repository at this point in the history
This is done by deleting parts in the reverse order.
  • Loading branch information
mhoram-kerbin committed Aug 19, 2022
1 parent ed0f6aa commit 984f3bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Source/WOLF/WOLF/Poof.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ public static void GoPoof(Vessel vessel)
//https://kerbalspaceprogram.com/api/class_fine_print_1_1_utilities_1_1_system_utilities.html#afd1eea0118d0c37dacd3ea696b125ff2
SystemUtilities.ExpungeKerbal(kerbal);
}
foreach (var part in vessel.parts.ToArray())

var parts = vessel.parts.ToArray();
for (var i = parts.Length - 1; i >= 0; i--)
{
part.Die();
parts[i].Die();
}

vessel.Die();

if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
Expand Down

0 comments on commit 984f3bc

Please sign in to comment.