Skip to content

Crash in RailroadTrack:getConnection() #521

@RenaKunisaki

Description

@RenaKunisaki

Describe the bug
Calling track:getConnection(0) on a RailroadTrack crashes the game.

fin-track-connection-crash.log

To Reproduce

  1. Build a computer with CPU and Network Card (maybe the latter isn't needed?)
  2. Build two train stations with a loop of track between them (maybe you can do less, I didn't check)
  3. Install an EEPROM with the contents:
local ANY_STATION = assert(component.proxy(component.findComponent(classes.RailroadStation))[1], "No RailroadStation found")
print("Station:", ANY_STATION)
local track = ANY_STATION:getTrackPos()
print("track:", track)
local conn = track:getConnection(0)
print("conn:", conn)

4. Run the computer.

Expected behavior
conn should be either a RailroadTrack or nil.

Additional context
Commenting out the line local conn = track:getConnection(0) should prevent the crash.

I created this test save to ensure it's not caused by anything in my existing save. No other mods were loaded.

This method didn't crash in previous versions, so probably a game update broke it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions