1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 23:12:08 +01:00

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 GitHub
parent 99f04f27de
commit 2fc877c2ec

View File

@@ -1492,7 +1492,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;
} }