[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) {
|
int FGAIAircraft::determineNextLeg(int leg) {
|
||||||
if (leg==AILeg::APPROACH) {
|
if (leg==AILeg::APPROACH) {
|
||||||
time_t now = globals->get_time_params()->get_cur_time();
|
time_t now = globals->get_time_params()->get_cur_time();
|
||||||
if (controller->getInstruction(getID()).getRunwaySlot()
|
if (controller == nullptr || controller->getInstruction(getID()).getRunwaySlot() > now) {
|
||||||
> now) {
|
|
||||||
return AILeg::HOLD;
|
return AILeg::HOLD;
|
||||||
} else {
|
} else {
|
||||||
return AILeg::LANDING;
|
return AILeg::LANDING;
|
||||||
|
|
|
@ -453,15 +453,15 @@ bool FGATCController::hasInstruction(int id)
|
||||||
|
|
||||||
FGATCInstruction FGATCController::getInstruction(int id)
|
FGATCInstruction FGATCController::getInstruction(int id)
|
||||||
{
|
{
|
||||||
// Search activeTraffic for a record matching our id
|
if (activeTraffic.size() != 0) {
|
||||||
TrafficVectorIterator i = searchActiveTraffic(id);
|
// Search activeTraffic for a record matching our id
|
||||||
|
TrafficVectorIterator i = searchActiveTraffic(id);
|
||||||
|
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i != activeTraffic.end())
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
return i->getInstruction();
|
||||||
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
|
||||||
} else {
|
|
||||||
return i->getInstruction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SG_LOG(SG_ATC, SG_ALERT, "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
return FGATCInstruction();
|
return FGATCInstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue