Skip to content

Commit 7badb10

Browse files
authored
Merge pull request #1123 from cesarBLG/null-active-locomotive
Handle null control active locomotive
2 parents 1bdb4bd + dc286f5 commit 7badb10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/Orts.Simulation/Common/Scripting/PowerSupply/ControlCarPowerSupply.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ protected override void SetCurrentElectricTrainSupplyState(PowerSupplyState stat
5151
protected override void SetCurrentDynamicBrakeAvailability(bool avail) {}
5252
public void SignalEventToControlActiveLocomotive(PowerSupplyEvent evt)
5353
{
54-
ControlActiveLocomotive.LocomotivePowerSupply.HandleEvent(evt);
54+
ControlActiveLocomotive?.LocomotivePowerSupply.HandleEvent(evt);
5555
}
5656
public void SignalEventToControlActiveLocomotive(PowerSupplyEvent evt, int id)
5757
{
58-
ControlActiveLocomotive.LocomotivePowerSupply.HandleEvent(evt, id);
58+
ControlActiveLocomotive?.LocomotivePowerSupply.HandleEvent(evt, id);
5959
}
6060
}
6161
}

0 commit comments

Comments
 (0)