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:
parent
f11572cd64
commit
c453d1a0cc
2 changed files with 14 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue