(svn r14343) -Fix [FS#2300]: invalid v->u.air.targetairport could cause crashes at several places when the station pool got smaller
This commit is contained in:
@@ -652,9 +652,11 @@ void Vehicle::PreDestructor()
|
||||
|
||||
if (this->type == VEH_ROAD) ClearSlot(this);
|
||||
if (this->type == VEH_AIRCRAFT && this->IsPrimaryVehicle()) {
|
||||
Station *st = GetStation(this->u.air.targetairport);
|
||||
const AirportFTA *layout = st->Airport()->layout;
|
||||
CLRBITS(st->airport_flags, layout[this->u.air.previous_pos].block | layout[this->u.air.pos].block);
|
||||
Station *st = GetTargetAirportIfValid(this);
|
||||
if (st != NULL) {
|
||||
const AirportFTA *layout = st->Airport()->layout;
|
||||
CLRBITS(st->airport_flags, layout[this->u.air.previous_pos].block | layout[this->u.air.pos].block);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->type != VEH_TRAIN || (this->type == VEH_TRAIN && (IsFrontEngine(this) || IsFreeWagon(this)))) {
|
||||
|
Reference in New Issue
Block a user