]> git.mxchange.org Git - flightgear.git/commitdiff
remove redundant if check in cases of if (foo) delete foo;
authormfranz <mfranz>
Fri, 20 Jul 2007 14:46:45 +0000 (14:46 +0000)
committermfranz <mfranz>
Fri, 20 Jul 2007 14:46:45 +0000 (14:46 +0000)
The C++ standard explicitly allows deleting a null pointer.

src/AIModel/AIFlightPlan.cxx
src/AIModel/AIFlightPlanCreate.cxx

index 362604be2aabac3514a8fa38dea4661da991d2ac..48af6afb81ae5d916a88ce3b3e808bf7be0dad98 100644 (file)
@@ -298,8 +298,7 @@ FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
 FGAIFlightPlan::~FGAIFlightPlan()
 {
   deleteWaypoints();
-  if (taxiRoute)
-    delete taxiRoute;
+  delete taxiRoute;
 }
 
 
@@ -492,8 +491,7 @@ void FGAIFlightPlan::restart()
 
 void FGAIFlightPlan::deleteTaxiRoute() 
 {
-  if (taxiRoute)
-    delete taxiRoute;
+  delete taxiRoute;
   taxiRoute = 0;
 }
 
index ea476a8f6ec548d9449a0e9d18d0243d90e8ff65..d615f4b5462439d26c57149f4033c3d461c7136a 100644 (file)
@@ -257,8 +257,7 @@ void FGAIFlightPlan::createTaxi(bool firstFlight, int direction,
          // Starting from gate 0 in this case is a bit of a hack
          // which requires a more proper solution later on.
          //FGTaxiRoute route;
-         if (taxiRoute)
-           delete taxiRoute;
+         delete taxiRoute;
          taxiRoute = new FGTaxiRoute;
          if (gateId >= 0)
            *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(gateId, 
@@ -427,8 +426,7 @@ void FGAIFlightPlan::createTaxi(bool firstFlight, int direction,
          // fallback mechanism for this. 
          // Starting from gate 0 is a bit of a hack...
          //FGTaxiRoute route;
-         if (taxiRoute)
-           delete taxiRoute;
+         delete taxiRoute;
          taxiRoute = new FGTaxiRoute;
          if (gateId >= 0)
            *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(runwayId,