[Spreadsheet] remove superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 01:49:41 +02:00
parent fc548a4b34
commit ce86b03e0a
5 changed files with 18 additions and 18 deletions

View File

@@ -126,7 +126,7 @@ bool PropertySheet::isValidAlias(const std::string &candidate)
boost::cmatch cm;
/* Check if it is used before */
if (getValueFromAlias(candidate) != nullptr)
if (getValueFromAlias(candidate))
return false;
/* Check to make sure it doesn't clash with a predefined unit */
@@ -578,14 +578,14 @@ Cell * PropertySheet::nonNullCellAt(CellAddress address)
void PropertySheet::setContent(CellAddress address, const char *value)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
cell->setContent(value);
}
void PropertySheet::setAlignment(CellAddress address, int _alignment)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
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 != nullptr);
assert(cell);
cell->setStyle(_style);
}
void PropertySheet::setForeground(CellAddress address, const App::Color &color)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
cell->setForeground(color);
}
void PropertySheet::setBackground(CellAddress address, const App::Color &color)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
cell->setBackground(color);
}
void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
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 != nullptr);
assert(cell);
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 != nullptr);
assert(cell);
cell->setComputedUnit(unit);
}
void PropertySheet::setSpans(CellAddress address, int rows, int columns)
{
Cell * cell = nonNullCellAt(address);
assert(cell != nullptr);
assert(cell);
cell->setSpans(rows, columns);
}
@@ -1133,7 +1133,7 @@ void PropertySheet::addDependencies(CellAddress key)
const Expression * expression = cell->getExpression();
if (expression == nullptr)
if (!expression)
return;
for(auto &var : expression->getIdentifiers()) {