Fix for bug 1304 - crash loading XML route
If the XML is malformed (missing <route> section), don't crash. https://code.google.com/p/flightgear-bugs/issues/detail?id=1304
This commit is contained in:
parent
16869d0362
commit
b0dcb657e7
1 changed files with 8 additions and 6 deletions
|
@ -828,12 +828,14 @@ void FlightPlan::loadVersion2XMLRoute(SGPropertyNode_ptr routeData)
|
|||
|
||||
// route nodes
|
||||
_legs.clear();
|
||||
SGPropertyNode_ptr routeNode = routeData->getChild("route", 0);
|
||||
for (int i=0; i<routeNode->nChildren(); ++i) {
|
||||
SGPropertyNode_ptr wpNode = routeNode->getChild("wp", i);
|
||||
Leg* l = new Leg(this, Waypt::createFromProperties(NULL, wpNode));
|
||||
_legs.push_back(l);
|
||||
} // of route iteration
|
||||
SGPropertyNode_ptr routeNode = routeData->getChild("route", 0);
|
||||
if (routeNode.valid()) {
|
||||
for (int i=0; i<routeNode->nChildren(); ++i) {
|
||||
SGPropertyNode_ptr wpNode = routeNode->getChild("wp", i);
|
||||
Leg* l = new Leg(this, Waypt::createFromProperties(NULL, wpNode));
|
||||
_legs.push_back(l);
|
||||
} // of route iteration
|
||||
}
|
||||
_waypointsChanged = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue