[FEM] remove more superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 02:34:57 +02:00
parent 5d76afe0a5
commit 48af573746
9 changed files with 16 additions and 16 deletions

View File

@@ -1675,7 +1675,7 @@ void CmdFemPostFunctions::activated(int iMsg)
this->updateActive();
//most of the times functions are added inside of a filter, make sure this still works
if (Gui::Application::Instance->activeDocument()->getInEdit() == nullptr)
if (!Gui::Application::Instance->activeDocument()->getInEdit())
doCommand(Gui, "Gui.activeDocument().setEdit('%s')", FeatName.c_str());
}
else {

View File

@@ -830,7 +830,7 @@ void TaskPostDataAlongLine::pointCallback(void* ud, SoEventCallback* n)
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint* point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No point picked.\n");
return;
}
@@ -1059,7 +1059,7 @@ void TaskPostDataAtPoint::pointCallback(void* ud, SoEventCallback* n)
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
const SoPickedPoint* point = n->getPickedPoint();
if (point == nullptr) {
if (!point) {
Base::Console().Message("No point picked.\n");
return;
}

View File

@@ -502,25 +502,25 @@ void ViewProviderFemConstraint::checkForWizard()
wizardWidget= nullptr;
wizardSubLayout = nullptr;
Gui::MainWindow* mw = Gui::getMainWindow();
if (mw == nullptr)
if (!mw)
return;
QDockWidget* dw = mw->findChild<QDockWidget*>(QString::fromLatin1("Combo View"));
if (dw == nullptr)
if (!dw)
return;
QWidget* cw = dw->findChild<QWidget*>(QString::fromLatin1("Combo View"));
if (cw == nullptr)
if (!cw)
return;
QTabWidget* tw = cw->findChild<QTabWidget*>(QString::fromLatin1("combiTab"));
if (tw == nullptr)
if (!tw)
return;
QStackedWidget* sw = tw->findChild<QStackedWidget*>(QString::fromLatin1("qt_tabwidget_stackedwidget"));
if (sw == nullptr)
if (!sw)
return;
QScrollArea* sa = sw->findChild<QScrollArea*>();
if (sa== nullptr)
if (!sa)
return;
QWidget* wd = sa->widget(); // This is the reason why we cannot use findChildByName() right away!!!
if (wd == nullptr)
if (!wd)
return;
QObject* wiz = findChildByName(wd, QString::fromLatin1("ShaftWizard"));
if (wiz) {

View File

@@ -71,7 +71,7 @@ bool ViewProviderFemConstraintBearing::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));

View File

@@ -71,7 +71,7 @@ bool ViewProviderFemConstraintFixed::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));

View File

@@ -69,7 +69,7 @@ bool ViewProviderFemConstraintFluidBoundary::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));

View File

@@ -70,7 +70,7 @@ bool ViewProviderFemConstraintForce::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));

View File

@@ -70,7 +70,7 @@ bool ViewProviderFemConstraintGear::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));

View File

@@ -69,7 +69,7 @@ bool ViewProviderFemConstraintPulley::setEdit(int ModNum)
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if ((wizardWidget == nullptr) || (wizardSubLayout == nullptr)) {
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));