Fix #14871, 80e58e751a: Possible crash when building NewGRF station under bridge. (#14872)

Triggered by reading random tile data before the tile is actually created.
This commit is contained in:
Peter Nelson
2025-12-07 11:59:20 +00:00
committed by dP
parent add6521abd
commit a3db9e7e80

View File

@@ -1495,7 +1495,7 @@ CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailTy
if (statspec != nullptr) { if (statspec != nullptr) {
uint32_t platinfo = GetPlatformInfo(AXIS_X, gfx, plat_len, numtracks, j, i, false); uint32_t platinfo = GetPlatformInfo(AXIS_X, gfx, plat_len, numtracks, j, i, false);
/* As the station is not yet completely finished, the station does not yet exist. */ /* As the station is not yet completely finished, the station does not yet exist. */
uint16_t callback = GetStationCallback(CBID_STATION_BUILD_TILE_LAYOUT, platinfo, 0, statspec, nullptr, tile); uint16_t callback = GetStationCallback(CBID_STATION_BUILD_TILE_LAYOUT, platinfo, 0, statspec, nullptr, INVALID_TILE);
if (callback != CALLBACK_FAILED && callback <= UINT8_MAX) gfx = (callback & ~1) + axis; if (callback != CALLBACK_FAILED && callback <= UINT8_MAX) gfx = (callback & ~1) + axis;
} }