]> git.mxchange.org Git - flightgear.git/commitdiff
Reset: route-manager guard against no plan.
authorJames Turner <zakalawe@mac.com>
Tue, 5 Nov 2013 05:31:02 +0000 (05:31 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 12 Nov 2013 22:55:36 +0000 (22:55 +0000)
src/Autopilot/route_mgr.cxx

index 72f3cccfebc2c531332aad99d6c828a9589c4c5d..12237717a24ee40c3c387291ade1edf21b9ced6d 100644 (file)
@@ -802,6 +802,10 @@ const char* FGRouteMgr::getDepartureRunway() const
 
 void FGRouteMgr::setDepartureRunway(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   FGAirport* apt = _plan->departureAirport();
   if (!apt || (aIdent == NULL)) {
     _plan->setDeparture(apt);
@@ -812,6 +816,10 @@ void FGRouteMgr::setDepartureRunway(const char* aIdent)
 
 void FGRouteMgr::setDepartureICAO(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
     _plan->setDeparture((FGAirport*) NULL);
   } else {
@@ -893,6 +901,10 @@ flightgear::SID* createDefaultSID(FGRunway* aRunway, double enrouteCourse)
 
 void FGRouteMgr::setSID(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   FGAirport* apt = _plan->departureAirport();
   if (!apt || (aIdent == NULL)) {
     _plan->setSID((flightgear::SID*) NULL);
@@ -943,6 +955,10 @@ const char* FGRouteMgr::getDestinationName() const
 
 void FGRouteMgr::setDestinationICAO(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   if ((aIdent == NULL) || (strlen(aIdent) < 4)) {
     _plan->setDestination((FGAirport*) NULL);
   } else {
@@ -961,6 +977,10 @@ const char* FGRouteMgr::getDestinationRunway() const
 
 void FGRouteMgr::setDestinationRunway(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   FGAirport* apt = _plan->destinationAirport();
   if (!apt || (aIdent == NULL)) {
     _plan->setDestination(apt);
@@ -1040,6 +1060,10 @@ flightgear::Approach* createDefaultApproach(FGRunway* aRunway, double aEnrouteCo
 
 void FGRouteMgr::setApproach(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   FGAirport* apt = _plan->destinationAirport();
   if (!strcmp(aIdent, "DEFAULT")) {
     double enrouteCourse = -1.0;
@@ -1069,6 +1093,10 @@ const char* FGRouteMgr::getSTAR() const
 
 void FGRouteMgr::setSTAR(const char* aIdent)
 {
+    if (!_plan) {
+        return;
+    }
+    
   FGAirport* apt = _plan->destinationAirport();
   if (!apt || (aIdent == NULL)) {
     _plan->setSTAR((STAR*) NULL);