Skip to content

Commit 81b11f7

Browse files
committed
Avoid error on inserting train without start time
1 parent 3ffb9bc commit 81b11f7

File tree

1 file changed

+6
-0
lines changed
  • Source/Orts.Simulation/Simulation/AIs

1 file changed

+6
-0
lines changed

Source/Orts.Simulation/Simulation/AIs/AI.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,12 @@ public class StartTrains : LinkedList<AITrain>
14081408

14091409
public void InsertTrain(AITrain thisTrain)
14101410
{
1411+
if (thisTrain.StartTime == null)
1412+
{
1413+
Trace.TraceInformation("Train : " + thisTrain.Name + " : missing start time, train not included");
1414+
return;
1415+
}
1416+
14111417
if (this.Count == 0)
14121418
{
14131419
this.AddFirst(thisTrain);

0 commit comments

Comments
 (0)