Skip to content

Commit dc286f5

Browse files
committed
Handle null active locomotive
1 parent da10def commit dc286f5

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)