[Part] remove superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-17 16:24:44 +02:00
parent c0bf0f5c72
commit 48e84945ed
6 changed files with 18 additions and 17 deletions

View File

@@ -613,7 +613,7 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args)
Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->SetPoleCol(vindex, poles);
}
else {
@@ -653,7 +653,7 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args)
Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->SetPoleRow(uindex, poles);
}
else {

View File

@@ -178,7 +178,7 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->InsertPoleColAfter(vindex, poles);
}
else {
@@ -218,7 +218,7 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->InsertPoleRowAfter(uindex, poles);
}
else {
@@ -258,7 +258,7 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->InsertPoleColBefore(vindex, poles);
}
else {
@@ -298,7 +298,7 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->InsertPoleRowBefore(uindex, poles);
}
else {
@@ -412,7 +412,7 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->SetPoleCol(vindex, poles);
}
else {
@@ -452,7 +452,7 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args)
Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast
(getGeometryPtr()->handle());
if (obj2 == nullptr) {
if (!obj2) {
surf->SetPoleRow(uindex, poles);
}
else {

View File

@@ -702,7 +702,7 @@ void DlgExtrusion::writeParametersToFeature(App::DocumentObject &feature, App::D
App::PropertyLinkSub lnk;
this->getAxisLink(lnk);
std::stringstream linkstr;
if(lnk.getValue() == nullptr){
if (!lnk.getValue()) {
linkstr << "None";
} else {
linkstr << "(App.getDocument(\"" << lnk.getValue()->getDocument()->getName() <<"\")." << lnk.getValue()->getNameInDocument();

View File

@@ -1052,14 +1052,15 @@ void SoBrepFaceSet::generatePrimitives(SoAction * action)
}
else {
tbind = PER_VERTEX_INDEXED;
if (tindices == nullptr) tindices = cindices;
if (!tindices)
tindices = cindices;
}
}
if (nbind == PER_VERTEX_INDEXED && nindices == nullptr) {
if (nbind == PER_VERTEX_INDEXED && !nindices) {
nindices = cindices;
}
if (mbind == PER_VERTEX_INDEXED && mindices == nullptr) {
if (mbind == PER_VERTEX_INDEXED && !mindices) {
mindices = cindices;
}

View File

@@ -68,7 +68,7 @@ namespace bp = boost::placeholders;
// Create reference name from PropertyLinkSub values in a translatable fashion
const QString makeRefString(const App::DocumentObject* obj, const std::string& sub)
{
if (obj == nullptr)
if (!obj)
return QObject::tr("No reference selected");
if (obj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
@@ -563,7 +563,7 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
return;
QLineEdit* line = getLine(idx);
if (line == nullptr)
if (!line)
return;
if (text.length() == 0) {
@@ -607,7 +607,7 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
parts.push_back(QString::fromLatin1(""));
// Check whether this is the name of an App::Plane or Part::Datum feature
App::DocumentObject* obj = ViewProvider->getObject()->getDocument()->getObject(parts[0].toLatin1());
if (obj == nullptr)
if (!obj)
return;
std::string subElement;

View File

@@ -210,7 +210,7 @@ void ResultEntry::buildEntryName()
while(parentEntry->parent != nullptr)
{
ResultEntry *temp = parentEntry->parent;
if (temp->parent == nullptr)
if (!temp->parent)
break;
parentEntry = parentEntry->parent;
}
@@ -841,7 +841,7 @@ QString PartGui::buildSelectionName(const ResultEntry *entry, const TopoDS_Shape
while(parentEntry->parent != nullptr)
{
ResultEntry *temp = parentEntry->parent;
if (temp->parent == nullptr)
if (!temp->parent)
break;
parentEntry = parentEntry->parent;
}