[Part] remove more superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 01:36:27 +02:00
parent dfecb337e7
commit 0ff8a02105
7 changed files with 10 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ BodyBase::BodyBase()
BodyBase* BodyBase::findBodyOf(const App::DocumentObject* f)
{
App::Document* doc = f->getDocument();
if (doc != nullptr) {
if (doc) {
std::vector<App::DocumentObject*> bodies = doc->getObjectsOfType(BodyBase::getClassTypeId());
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
BodyBase* body = static_cast<BodyBase*>(*b);

View File

@@ -71,8 +71,8 @@ void Revolution::onChanged(const App::Property* prop)
{
if(! this->isRestoring()){
if(prop == &AxisLink){
Base.setReadOnly(AxisLink.getValue() != nullptr);
Axis.setReadOnly(AxisLink.getValue() != nullptr);
Base.setReadOnly(AxisLink.getValue());
Axis.setReadOnly(AxisLink.getValue());
}
}
Part::Feature::onChanged(prop);

View File

@@ -334,7 +334,7 @@ DlgPrimitives::DlgPrimitives(QWidget* parent, Part::Primitive* feature)
ui->widgetStack2->setCurrentIndex(index);
// if existing, the primitive type can not be changed by the user
ui->PrimitiveTypeCB->setDisabled(feature != nullptr);
ui->PrimitiveTypeCB->setDisabled(feature);
// ToDo: connect signal if there is a preview of primitives available
// read values from the properties

View File

@@ -99,7 +99,7 @@ void TaskAttacher::makeRefStrings(std::vector<QString>& refstrings, std::vector<
refnames = pcAttach->Support.getSubValues();
for (size_t r = 0; r < 4; r++) {
if ((r < refs.size()) && (refs[r] != nullptr)) {
if ((r < refs.size()) && (refs[r])) {
refstrings.push_back(makeRefString(refs[r], refnames[r]));
// for Origin or Datum features refnames is empty but we need a non-empty return value
if (refnames[r].empty())
@@ -419,7 +419,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg)
}
QLineEdit* line = getLine(iActiveRef);
if (line != nullptr) {
if (line) {
line->blockSignals(true);
line->setText(makeRefString(selObj, subname));
line->setProperty("RefName", QByteArray(subname.c_str()));

View File

@@ -207,7 +207,7 @@ ResultEntry::~ResultEntry()
void ResultEntry::buildEntryName()
{
ResultEntry *parentEntry = this;
while(parentEntry->parent != nullptr)
while(parentEntry->parent)
{
ResultEntry *temp = parentEntry->parent;
if (!temp->parent)
@@ -838,7 +838,7 @@ bool TaskCheckGeometryResults::split(QString &input, QString &doc, QString &obje
QString PartGui::buildSelectionName(const ResultEntry *entry, const TopoDS_Shape &shape)
{
const ResultEntry *parentEntry = entry;
while(parentEntry->parent != nullptr)
while(parentEntry->parent)
{
ResultEntry *temp = parentEntry->parent;
if (!temp->parent)

View File

@@ -1454,7 +1454,7 @@ void PartGui::SteppedSelection::buildPixmaps()
void PartGui::SteppedSelection::selectionSlot(bool checked)
{
QPushButton *sender = qobject_cast<QPushButton*>(QObject::sender());
assert(sender != nullptr);
assert(sender);
std::vector<ButtonIconPairType>::iterator it;
for (it = buttons.begin(); it != buttons.end(); ++it)
if (it->first == sender)

View File

@@ -840,7 +840,7 @@ void ViewProviderPartExt::reload()
void ViewProviderPartExt::updateData(const App::Property* prop)
{
const char *propName = prop->getName();
if (propName && (strcmp(propName, "Shape") == 0 || strstr(propName, "Touched") != nullptr)) {
if (propName && (strcmp(propName, "Shape") == 0 || strstr(propName, "Touched"))) {
// calculate the visual only if visible
if (isUpdateForced() || Visibility.getValue())
updateVisual();