[App] remove superfluous nullptr checks

This commit is contained in:
Uwe
2022-07-18 03:12:01 +02:00
parent b801e7151a
commit e69a920f18
12 changed files with 55 additions and 54 deletions

View File

@@ -1976,11 +1976,11 @@ Py::Object FunctionExpression::evalAggregate(
if (!p)
continue;
if ((qp = freecad_dynamic_cast<PropertyQuantity>(p)) != nullptr)
if ((qp = freecad_dynamic_cast<PropertyQuantity>(p)))
c->collect(qp->getQuantityValue());
else if ((fp = freecad_dynamic_cast<PropertyFloat>(p)) != nullptr)
else if ((fp = freecad_dynamic_cast<PropertyFloat>(p)))
c->collect(Quantity(fp->getValue()));
else if ((ip = freecad_dynamic_cast<PropertyInteger>(p)) != nullptr)
else if ((ip = freecad_dynamic_cast<PropertyInteger>(p)))
c->collect(Quantity(ip->getValue()));
else
_EXPR_THROW("Invalid property type for aggregate.", owner);
@@ -2858,7 +2858,7 @@ Expression *ConditionalExpression::simplify() const
std::unique_ptr<Expression> e(condition->simplify());
NumberExpression * v = freecad_dynamic_cast<NumberExpression>(e.get());
if (v == nullptr)
if (!v)
return new ConditionalExpression(owner, condition->simplify(), trueExpr->simplify(), falseExpr->simplify());
else {
if (fabs(v->getValue()) > 0.5)
@@ -3327,7 +3327,7 @@ Expression * App::ExpressionParser::parse(const App::DocumentObject *owner, cons
if (result != 0)
throw ParserError("Failed to parse expression.");
if (ScanResult == nullptr)
if (!ScanResult)
throw ParserError("Unknown error in expression");
if (valueExpression)
@@ -3355,7 +3355,7 @@ UnitExpression * ExpressionParser::parseUnit(const App::DocumentObject *owner, c
if (result != 0)
throw ParserError("Failed to parse expression.");
if (ScanResult == nullptr)
if (!ScanResult)
throw ParserError("Unknown error in expression");
// Simplify expression