mirror of https://github.com/OpenTTD/OpenTTD
Fix #8809: Crash when removing airport when hangar window open
parent
2860de7bf4
commit
25909b06d2
|
@ -2393,6 +2393,12 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
|
||||||
|
DeleteWindowById(
|
||||||
|
WC_VEHICLE_DEPOT, st->airport.GetHangarTile(i)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const AirportSpec *as = st->airport.GetSpec();
|
const AirportSpec *as = st->airport.GetSpec();
|
||||||
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center.
|
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center.
|
||||||
* And as for construction, always remove it, even if the setting is not set, in order to avoid the
|
* And as for construction, always remove it, even if the setting is not set, in order to avoid the
|
||||||
|
@ -2423,12 +2429,6 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
/* Clear the persistent storage. */
|
/* Clear the persistent storage. */
|
||||||
delete st->airport.psa;
|
delete st->airport.psa;
|
||||||
|
|
||||||
for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
|
|
||||||
DeleteWindowById(
|
|
||||||
WC_VEHICLE_DEPOT, st->airport.GetHangarTile(i)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
st->rect.AfterRemoveRect(st, st->airport);
|
st->rect.AfterRemoveRect(st, st->airport);
|
||||||
|
|
||||||
st->airport.Clear();
|
st->airport.Clear();
|
||||||
|
|
Loading…
Reference in New Issue