[poincare] Check if Expression is Rational before casting it

This commit is contained in:
Léa Saviot
2018-09-24 11:16:39 +02:00
committed by EmilieNumworks
parent 4e8cd02d3f
commit c12b86cdd4

View File

@@ -143,7 +143,7 @@ Expression Logarithm::shallowReduce(Context & context, Preferences::AngleUnit an
Expression Logarithm::simpleShallowReduce(Context & context, Preferences::AngleUnit angleUnit) {
Expression c = childAtIndex(0);
// log(0,0)->Undefined
if (numberOfChildren() == 2 && childAtIndex(1).type() == ExpressionNode::Type::Rational && childAtIndex(1).convert<Rational>().isZero() && static_cast<Rational &>(c).isZero()) {
if (numberOfChildren() == 2 && c.type() == ExpressionNode::Type::Rational && childAtIndex(1).type() == ExpressionNode::Type::Rational && childAtIndex(1).convert<Rational>().isZero() && static_cast<Rational &>(c).isZero()) {
Expression result = Undefined();
replaceWithInPlace(result);
return result;