Fix crash with invalid airway in route
This commit is contained in:
parent
31f8f86e12
commit
df810f7970
2 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue