From 7b4e01426376344b333c2ba5e3a18ac6268befc7 Mon Sep 17 00:00:00 2001 From: Uwe Date: Mon, 18 Jul 2022 02:54:09 +0200 Subject: [PATCH] [Robot etc.] remove superfluous nullptr checks --- src/Mod/Points/App/PointsGrid.cpp | 2 +- src/Mod/ReverseEngineering/App/ApproxSurface.cpp | 2 +- src/Mod/Robot/App/WaypointPyImp.cpp | 4 ++-- src/Mod/Robot/Gui/CommandTrajectory.cpp | 6 +++--- src/Mod/Surface/App/FeatureGeomFillSurface.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Mod/Points/App/PointsGrid.cpp b/src/Mod/Points/App/PointsGrid.cpp index 84086650fb..5e391dd35c 100644 --- a/src/Mod/Points/App/PointsGrid.cpp +++ b/src/Mod/Points/App/PointsGrid.cpp @@ -656,7 +656,7 @@ void PointsGrid::Validate (const PointKernel &rclPoints) void PointsGrid::Validate () { - if (_pclPoints == nullptr) + if (!_pclPoints) return; if (_pclPoints->size() != _ulCtElements) diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index c78de802ef..2cffc3c081 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -720,7 +720,7 @@ Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Arra bool bParaCor, double fSizeFactor) { - if (_pvcPoints != nullptr) { + if (_pvcPoints) { delete _pvcPoints; _pvcPoints = nullptr; delete _pvcUVParam; diff --git a/src/Mod/Robot/App/WaypointPyImp.cpp b/src/Mod/Robot/App/WaypointPyImp.cpp index 9e342b1d3f..9f228d7b4d 100644 --- a/src/Mod/Robot/App/WaypointPyImp.cpp +++ b/src/Mod/Robot/App/WaypointPyImp.cpp @@ -113,7 +113,7 @@ int WaypointPy::PyInit(PyObject* args, PyObject* kwd) else getWaypointPtr()->Type = Waypoint::UNDEF; - if (vel == nullptr) + if (!vel) switch (getWaypointPtr()->Type) { case Waypoint::PTP: getWaypointPtr()->Velocity = 100; @@ -132,7 +132,7 @@ int WaypointPy::PyInit(PyObject* args, PyObject* kwd) getWaypointPtr()->Cont = cont ? true : false; getWaypointPtr()->Tool = tool; getWaypointPtr()->Base = base; - if (acc == nullptr) + if (!acc) getWaypointPtr()->Acceleration = 100; else getWaypointPtr()->Acceleration = Base::UnitsApi::toDouble(acc, Base::Unit::Acceleration); diff --git a/src/Mod/Robot/Gui/CommandTrajectory.cpp b/src/Mod/Robot/Gui/CommandTrajectory.cpp index 7114e48e95..0262a35ca9 100644 --- a/src/Mod/Robot/Gui/CommandTrajectory.cpp +++ b/src/Mod/Robot/Gui/CommandTrajectory.cpp @@ -178,16 +178,16 @@ void CmdRobotInsertWaypointPreselect::activated(int) Robot::TrajectoryObject *pcTrajectoryObject; - if(Sel[0].pObject->getTypeId() == Robot::TrajectoryObject::getClassTypeId()) + if (Sel[0].pObject->getTypeId() == Robot::TrajectoryObject::getClassTypeId()) pcTrajectoryObject = static_cast(Sel[0].pObject); - else { + else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select one Trajectory object.")); return; } std::string TrakName = pcTrajectoryObject->getNameInDocument(); - if(PreSel.pDocName == nullptr){ + if (!PreSel.pDocName) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No preselection"), QObject::tr("You have to hover above a geometry (Preselection) with the mouse to use this command. See documentation for details.")); return; diff --git a/src/Mod/Surface/App/FeatureGeomFillSurface.cpp b/src/Mod/Surface/App/FeatureGeomFillSurface.cpp index 4ccddc1635..d18dcd868b 100644 --- a/src/Mod/Surface/App/FeatureGeomFillSurface.cpp +++ b/src/Mod/Surface/App/FeatureGeomFillSurface.cpp @@ -94,7 +94,7 @@ void ShapeValidator::checkEdge(const TopoDS_Shape& shape) void ShapeValidator::checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_WireData) *aWD) { checkEdge(shape); - if (aWD != nullptr) { + if (aWD) { BRepBuilderAPI_Copy copier(shape); // make a copy of the shape and the underlying geometry to avoid to affect the input shapes (*aWD)->Add(TopoDS::Edge(copier.Shape())); @@ -104,7 +104,7 @@ void ShapeValidator::checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_W void ShapeValidator::checkAndAdd(const Part::TopoShape &ts, const char *subName, Handle(ShapeExtend_WireData) *aWD) { try { - if (subName != nullptr && *subName != '\0') { + if (subName && *subName != '\0') { //we want only the subshape which is linked checkAndAdd(ts.getSubShape(subName), aWD); }