Add some pointer checks - so we at least get some error message naming the airport with the broken network.
This commit is contained in:
parent
484d3c61f8
commit
277ba10b39
1 changed files with 21 additions and 0 deletions
|
@ -580,9 +580,23 @@ FGTaxiRoute FGGroundNetwork::findShortestRoute(int start, int end,
|
|||
}
|
||||
|
||||
FGTaxiNode *firstNode = findNode(start);
|
||||
if (!firstNode)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||
"Error in ground network. Failed to find first waypoint: " << start
|
||||
<< " at " << ((parent) ? parent->getId() : "<unknown>"));
|
||||
return FGTaxiRoute();
|
||||
}
|
||||
firstNode->setPathScore(0);
|
||||
|
||||
FGTaxiNode *lastNode = findNode(end);
|
||||
if (!lastNode)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||
"Error in ground network. Failed to find last waypoint: " << end
|
||||
<< " at " << ((parent) ? parent->getId() : "<unknown>"));
|
||||
return FGTaxiRoute();
|
||||
}
|
||||
|
||||
FGTaxiNodeVector unvisited(*currNodesSet); // working copy
|
||||
|
||||
|
@ -606,6 +620,13 @@ FGTaxiRoute FGGroundNetwork::findShortestRoute(int start, int end,
|
|||
seg != best->getEndRoute(); seg++) {
|
||||
if (fullSearch || (*seg)->isPushBack()) {
|
||||
FGTaxiNode *tgt = (*seg)->getEnd();
|
||||
if (!tgt)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||
"Error in ground network. Found empty segment "
|
||||
<< " at " << ((parent) ? parent->getId() : "<unknown>"));
|
||||
return FGTaxiRoute();
|
||||
}
|
||||
double alt =
|
||||
best->getPathScore() + (*seg)->getLength() +
|
||||
(*seg)->getPenalty(nParkings);
|
||||
|
|
Loading…
Reference in a new issue