Fix heap use after free when removing oil rig
This commit is contained in:
@@ -4390,6 +4390,10 @@ void DeleteOilRig(TileIndex tile)
|
||||
MakeWaterKeepingClass(tile, OWNER_NONE);
|
||||
|
||||
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