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;