From f3628f368f9c28d149a88ae740c74b8f952f7344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 28 Jul 2020 17:07:22 +0200 Subject: [PATCH] [poincare/expression] Return undef if simplification interrupted Without this change, we would get weird "reduced" expression, such as multiplication(undef, _s), but we do not always check sSimplificationHasBeenInterrupted afterwards. --- poincare/src/expression.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 756ddd69a..f9b066832 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -817,7 +817,11 @@ Expression Expression::angleUnitToRadian(Preferences::AngleUnit angleUnit) { Expression Expression::reduce(ExpressionNode::ReductionContext reductionContext) { sSimplificationHasBeenInterrupted = false; - return deepReduce(reductionContext); + Expression result = deepReduce(reductionContext); + if (sSimplificationHasBeenInterrupted) { + return replaceWithUndefinedInPlace(); + } + return result; } Expression Expression::deepReduce(ExpressionNode::ReductionContext reductionContext) {