re-add some nullptr

to be safe since their removal within assert() or bools might have some impact I don't know
This commit is contained in:
Uwe
2022-07-18 02:32:36 +02:00
parent 8b99abd81b
commit 24468b59ad
8 changed files with 23 additions and 24 deletions

View File

@@ -71,8 +71,8 @@ void Revolution::onChanged(const App::Property* prop)
{
if(! this->isRestoring()){
if(prop == &AxisLink){
Base.setReadOnly(AxisLink.getValue());
Axis.setReadOnly(AxisLink.getValue());
Base.setReadOnly(AxisLink.getValue() != nullptr);
Axis.setReadOnly(AxisLink.getValue() != nullptr);
}
}
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);
ui->PrimitiveTypeCB->setDisabled(feature != nullptr);
// ToDo: connect signal if there is a preview of primitives available
// read values from the properties

View File

@@ -207,13 +207,12 @@ ResultEntry::~ResultEntry()
void ResultEntry::buildEntryName()
{
ResultEntry *parentEntry = this;
while(parentEntry->parent)
{
ResultEntry *temp = parentEntry->parent;
if (!temp->parent)
break;
parentEntry = parentEntry->parent;
}
while (parentEntry->parent != nullptr) {
ResultEntry *temp = parentEntry->parent;
if (!temp->parent)
break;
parentEntry = parentEntry->parent;
}
QString stringOut;
QTextStream stream(&stringOut);

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);
assert(sender != nullptr);
std::vector<ButtonIconPairType>::iterator it;
for (it = buttons.begin(); it != buttons.end(); ++it)
if (it->first == sender)

View File

@@ -410,7 +410,7 @@ void ProfileBased::onChanged(const App::Property* prop)
{
if (prop == &Profile) {
// if attached to a sketch then mark it as read-only
this->Placement.setStatus(App::Property::ReadOnly, Profile.getValue());
this->Placement.setStatus(App::Property::ReadOnly, Profile.getValue() != nullptr);
}
FeatureAddSub::onChanged(prop);

View File

@@ -200,7 +200,7 @@ void Workbench::setupContextMenu(const char* recipient, Gui::MenuItem* item) con
if ( docHaveBodies ) {
bool addMoveFeature = true;
bool addMoveFeatureInTree = body;
bool addMoveFeatureInTree = (body != nullptr);
for (auto sel: selection) {
// if at least one selected feature cannot be moved to a body
// disable the entry

View File

@@ -578,14 +578,14 @@ Cell * PropertySheet::nonNullCellAt(CellAddress address)
void PropertySheet::setContent(CellAddress address, const char *value)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setContent(value);
}
void PropertySheet::setAlignment(CellAddress address, int _alignment)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
if (cell->address != address) //Reject alignment change for merged cell except top-left one
return;
cell->setAlignment(_alignment);
@@ -594,28 +594,28 @@ void PropertySheet::setAlignment(CellAddress address, int _alignment)
void PropertySheet::setStyle(CellAddress address, const std::set<std::string> &_style)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setStyle(_style);
}
void PropertySheet::setForeground(CellAddress address, const App::Color &color)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setForeground(color);
}
void PropertySheet::setBackground(CellAddress address, const App::Color &color)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setBackground(color);
}
void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setDisplayUnit(unit);
}
@@ -627,7 +627,7 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias)
const Cell * aliasedCell = getValueFromAlias(alias);
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
if(aliasedCell == cell)
return;
@@ -671,14 +671,14 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias)
void PropertySheet::setComputedUnit(CellAddress address, const Base::Unit &unit)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setComputedUnit(unit);
}
void PropertySheet::setSpans(CellAddress address, int rows, int columns)
{
Cell * cell = nonNullCellAt(address);
assert(cell);
assert(cell != nullptr);
cell->setSpans(rows, columns);
}

View File

@@ -384,7 +384,7 @@ Cell *Sheet::getNewCell(CellAddress address)
void Sheet::setCell(const char * address, const char * contents)
{
assert(address && contents);
assert(address != nullptr && contents != nullptr);
setCell(CellAddress(address), contents);
}
@@ -400,7 +400,7 @@ void Sheet::setCell(const char * address, const char * contents)
void Sheet::setCell(CellAddress address, const char * value)
{
assert(value);
assert(value != nullptr);
if (*value == '\0') {