From f562886a7ed0c5a6ff17f87efd5abbaa1f3fe6f1 Mon Sep 17 00:00:00 2001 From: Hugo Saint-Vignes Date: Tue, 11 Aug 2020 11:26:48 +0200 Subject: [PATCH] [poincare] Fixed crash due to infinite loop with horizontal layout Change-Id: I00106525b29ce441e10a6d88766efdecd80d8291 --- poincare/src/integral_layout.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poincare/src/integral_layout.cpp b/poincare/src/integral_layout.cpp index 6d6119560..9729fb9e6 100644 --- a/poincare/src/integral_layout.cpp +++ b/poincare/src/integral_layout.cpp @@ -266,7 +266,10 @@ IntegralLayoutNode * IntegralLayoutNode::previousNestedIntegral() { } if (p->numberOfChildren() == 1 && prev->type() == Type::IntegralLayout) { // We can consider the integrals in a row only if the horizontal layout just contains an integral - return static_cast(prev); + // The horizontal layout must be the previous integral's integrand + if (prev->childAtIndex(0) == p) { + return static_cast(prev); + } } } return nullptr;