From 206013f2db06e95e985aad80b01b8b6af0fbf44d Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Mon, 17 Aug 2020 12:11:25 +0200 Subject: [PATCH] [poincare/multiplication] Return Undef early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiplication::privateShallowReduce can create an Undef node by multiplying 0 and inf. In this case, we set the whole multiplication to undef, to avoid things such as undef*π. This fixes the following bug : - In Graph, enter i*inf*π as one of the bounds. An assertion fails in Multiplication::removeUnit. Change-Id: Ie9d0d561d6e310f52220b98541f22a4b5e56762c --- poincare/src/multiplication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/poincare/src/multiplication.cpp b/poincare/src/multiplication.cpp index f647d6c4d..bf518c2ce 100644 --- a/poincare/src/multiplication.cpp +++ b/poincare/src/multiplication.cpp @@ -778,6 +778,9 @@ Expression Multiplication::privateShallowReduce(ExpressionNode::ReductionContext SetInterruption(true); return *this; } + if (m.isUndefined()) { + return replaceWithUndefinedInPlace(); + } replaceChildAtIndexInPlace(0, m); removeChildAtIndexInPlace(i); } else {