Fix #7820: Heap use after free when removing oil rig
This commit is contained in:

committed by
Michael Lutz

parent
460f73cd2d
commit
2be619ea88
@@ -4172,6 +4172,10 @@ void DeleteOilRig(TileIndex tile)
|
||||
|
||||
/* The oil rig station is not supposed to be shared with anything else */
|
||||
assert(st->facilities == (FACIL_AIRPORT | FACIL_DOCK) && st->airport.type == AT_OILRIG);
|
||||
if (st->industry != nullptr && st->industry->neutral_station == st) {
|
||||
/* Don't leave dangling neutral station pointer */
|
||||
st->industry->neutral_station = nullptr;
|
||||
}
|
||||
delete st;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user