From 2fc877c2ec2299632e3457864ae40d26ac63d3f7 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 562f1c1b1f..52d205a156 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1492,7 +1492,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; }