1
0
Fork 0

Fix crash with invalid airway in route

This commit is contained in:
James Turner 2018-11-12 16:47:18 +01:00
parent 31f8f86e12
commit df810f7970
2 changed files with 4 additions and 3 deletions

View file

@ -557,9 +557,10 @@ static void buildWaypoints(AStarOpenNodeRef aNode, WayptVec& aRoute)
for (n = aNode; n; n=n->previous) {
// get / create airway to be the owner for this waypoint
AirwayRef awy = Airway::loadByCacheId(n->airway);
// assert(awy);
auto wp = new NavaidWaypoint(n->node, awy);
wp->setFlag(WPT_VIA);
if (awy) {
wp->setFlag(WPT_VIA);
}
wp->setFlag(WPT_GENERATED);
aRoute[--count] = wp;
}

View file

@ -331,7 +331,7 @@ void Waypt::writeToProperties(SGPropertyNode_ptr aProp) const
aProp->setBoolValue("approach", true);
}
if (flag(WPT_VIA)) {
if (flag(WPT_VIA) && _owner) {
flightgear::AirwayRef awy = (flightgear::Airway*) _owner;
aProp->setStringValue("airway", awy->ident());
aProp->setIntValue("network", awy->level());