1
0
Fork 0

remove redundant if check in cases of if (foo) delete foo;

The C++ standard explicitly allows deleting a null pointer.
This commit is contained in:
mfranz 2007-07-20 14:46:45 +00:00
parent da77779436
commit 5c912ffad9
2 changed files with 4 additions and 8 deletions

View 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;
}

View 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,