Page 1 of 1

[2.0.46] train.schedule = train.schedule, index out of bounds

Posted: Tue Apr 29, 2025 10:19 am
by Quezler
- create a world
- place rails
- place locomotive
- give it an interrupt
- /c game.player.selected.train.schedule = game.player.selected.train.schedule
(note that platforms are also affected, but you can figure out those repro steps)

When a train has no schedule and no interrupts `train.schedule` is nil, as expected.
But when there are interrupts only .schedule` returns {current = 1, records = {}}

This cannot be written back to .schedule since it complains that there is no record at index 1.

Since this "legacy schedule" only contains scheduled records it should just return nil when the train has no active schedules, regardless of configured interrupts.

devs: see #7591