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:
parent
da77779436
commit
5c912ffad9
2 changed files with 4 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue