[ATC] Fix for Segfault occurring for AI approach aircraft.
This commit is contained in:
parent
d372890c98
commit
a562255008
2 changed files with 8 additions and 9 deletions
|
@ -1425,8 +1425,7 @@ const string& FGAIAircraft::atGate()
|
|||
int FGAIAircraft::determineNextLeg(int leg) {
|
||||
if (leg==AILeg::APPROACH) {
|
||||
time_t now = globals->get_time_params()->get_cur_time();
|
||||
if (controller->getInstruction(getID()).getRunwaySlot()
|
||||
> now) {
|
||||
if (controller == nullptr || controller->getInstruction(getID()).getRunwaySlot() > now) {
|
||||
return AILeg::HOLD;
|
||||
} else {
|
||||
return AILeg::LANDING;
|
||||
|
|
|
@ -453,15 +453,15 @@ bool FGATCController::hasInstruction(int id)
|
|||
|
||||
FGATCInstruction FGATCController::getInstruction(int id)
|
||||
{
|
||||
// Search activeTraffic for a record matching our id
|
||||
TrafficVectorIterator i = searchActiveTraffic(id);
|
||||
if (activeTraffic.size() != 0) {
|
||||
// Search activeTraffic for a record matching our id
|
||||
TrafficVectorIterator i = searchActiveTraffic(id);
|
||||
|
||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
||||
SG_LOG(SG_ATC, SG_ALERT,
|
||||
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||
} else {
|
||||
return i->getInstruction();
|
||||
if (i != activeTraffic.end())
|
||||
return i->getInstruction();
|
||||
}
|
||||
|
||||
SG_LOG(SG_ATC, SG_ALERT, "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||
return FGATCInstruction();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue