]> git.mxchange.org Git - flightgear.git/commitdiff
Fix reset crash, thanks to Joe: make findNextWithPartial, and the route-manager,...
authorjmt <jmt>
Wed, 9 Dec 2009 18:16:36 +0000 (18:16 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 11 Dec 2009 23:11:34 +0000 (00:11 +0100)
src/Autopilot/route_mgr.cxx
src/Navaids/positioned.cxx

index 313cd33ed6564d6901776a82e71c403f33a99df4..bbd2db96b58531c063ecbee448a26ee897395420 100644 (file)
@@ -775,7 +775,11 @@ const char* FGRouteMgr::getDepartureName() const
 
 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
@@ -798,6 +802,10 @@ const char* FGRouteMgr::getDestinationName() const
 
 void FGRouteMgr::setDestinationICAO(const char* aIdent)
 {
-  _destination = FGAirport::findByIdent(aIdent);
+  if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
+    _destination = NULL;
+  } else {
+    _destination = FGAirport::findByIdent(aIdent);
+  }
 }
     
index f3e683fb9e48f7b0a1163f4fbaf6bb86bf1342a2..8130b54b9c383422bbeb34a50eac0fe5e467d9e5 100644 (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.