1
0
Fork 0

Fix reset crash, thanks to Joe: make findNextWithPartial, and the route-manager, robust about people setting NULL / empty airport idents.

This commit is contained in:
jmt 2009-12-09 18:16:36 +00:00 committed by Tim Moore
parent f11572cd64
commit c453d1a0cc
2 changed files with 14 additions and 2 deletions

View file

@ -775,7 +775,11 @@ const char* FGRouteMgr::getDepartureName() const
void FGRouteMgr::setDepartureICAO(const char* aIdent)
{
if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
_departure = NULL;
} else {
_departure = FGAirport::findByIdent(aIdent);
}
}
const char* FGRouteMgr::getDestinationICAO() const
@ -798,6 +802,10 @@ const char* FGRouteMgr::getDestinationName() const
void FGRouteMgr::setDestinationICAO(const char* aIdent)
{
if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
_destination = NULL;
} else {
_destination = FGAirport::findByIdent(aIdent);
}
}

View file

@ -694,6 +694,10 @@ FGPositioned::findClosestN(const SGGeod& aPos, unsigned int aN, double aCutoffNm
FGPositionedRef
FGPositioned::findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter)
{
if (aId.empty()) {
return NULL;
}
std::string id(boost::to_upper_copy(aId));
// It is essential to bound our search, to avoid iterating all the way to the end of the database.