void FGRouteMgr::setDepartureICAO(const char* aIdent)
{
- _departure = FGAirport::findByIdent(aIdent);
+ if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
+ _departure = NULL;
+ } else {
+ _departure = FGAirport::findByIdent(aIdent);
+ }
}
const char* FGRouteMgr::getDestinationICAO() const
void FGRouteMgr::setDestinationICAO(const char* aIdent)
{
- _destination = FGAirport::findByIdent(aIdent);
+ if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
+ _destination = NULL;
+ } else {
+ _destination = FGAirport::findByIdent(aIdent);
+ }
}
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.