From c12b86cdd47155887bb13c17e2bbbef4f1c02271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 24 Sep 2018 11:16:39 +0200 Subject: [PATCH] [poincare] Check if Expression is Rational before casting it --- poincare/src/logarithm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poincare/src/logarithm.cpp b/poincare/src/logarithm.cpp index d6b9ec414..701874f6a 100644 --- a/poincare/src/logarithm.cpp +++ b/poincare/src/logarithm.cpp @@ -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().isZero() && static_cast(c).isZero()) { + if (numberOfChildren() == 2 && c.type() == ExpressionNode::Type::Rational && childAtIndex(1).type() == ExpressionNode::Type::Rational && childAtIndex(1).convert().isZero() && static_cast(c).isZero()) { Expression result = Undefined(); replaceWithInPlace(result); return result;