1
0
Fork 0

ATC: Fix crash with missing traffic ID

https://sourceforge.net/p/flightgear/codetickets/2254/
This commit is contained in:
James Turner 2020-06-08 22:43:20 +01:00
parent 32ff21c1df
commit 2574783656

View file

@ -220,17 +220,17 @@ void FGGroundController::updateAircraftInformation(int id, double lat, double lo
// Search the activeTraffic vector to find a traffic vector with our id
TrafficVectorIterator i = searchActiveTraffic(id);
TrafficVectorIterator current, closest;
// update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
SG_LOG(SG_GENERAL, SG_ALERT,
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
current = i;
if (i == activeTraffic.end() || activeTraffic.empty()) {
SG_LOG(SG_GENERAL, SG_DEV_WARN,
"AI error: updating aircraft without traffic record at " << SG_ORIGIN << ", id=" << id);
return;
}
i->setPositionAndHeading(lat, lon, heading, speed, alt);
TrafficVectorIterator current = i;
setDt(getDt() + dt);
// Update every three secs, but add some randomness