From a3db9e7e80f9aec8be7515596fa9ab696122040f Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 7 Dec 2025 11:59:20 +0000 Subject: [PATCH] Fix #14871, 80e58e751a: Possible crash when building NewGRF station under bridge. (#14872) Triggered by reading random tile data before the tile is actually created. --- src/station_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index f2e83e1ce2..6d9b7fd99e 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1495,7 +1495,7 @@ CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailTy if (statspec != nullptr) { 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. */ - 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; }