App: [skip ci] throw an exception if the expression gives NaN

This commit is contained in:
wmayer
2020-06-06 13:04:01 +02:00
parent 6cbf93dd5f
commit 4a449d1d0b

View File

@@ -2301,7 +2301,12 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std
_EXPR_THROW("Unknown function: " << f,expr);
}
return Py::asObject(new QuantityPy(new Quantity(scaler * output, unit)));
Quantity q(scaler * output, unit);
if (!q.isValid()) {
throw Base::ValueError("Not a number");
}
return Py::asObject(new QuantityPy(new Quantity(q)));
}
Py::Object FunctionExpression::_getPyValue() const {