Skip to content

Commit 3ca0eb1

Browse files
committed
Fix-Crash-Player-Train-changed-by-TrainList
1 parent 1a5693d commit 3ca0eb1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@ void AddSpace()
322322
line.AddSpace(textHeight / 2, line.RemainingHeight);
323323
}
324324

325-
if (LabelPositionTop.Count == 0)
325+
// Avoids crash when the PlayerTrain was changed from the Train List window
326+
if (LabelPositionTop.Count == 0 || PlayerTrain.Cars.Count != LabelPositionTop.Count)
326327
{
328+
LabelPositionTop.Clear();
327329
var n = scrollbox.Position.Y;// first row
328330
for (var i = 0; i < PlayerTrain.Cars.Count; i++)
329331
{ // Position of each row

0 commit comments

Comments
 (0)