[Poincare/integral_layout.cpp] Fixed crash due to infinite loop

Changed previousNestedIntegral method to prevent integrals located in
integral bounds to be considered as nested.

Change-Id: Id8cc4369f53c278ac59039fde1c2818af2ccacab
This commit is contained in:
Arthur Camouseigt
2020-08-07 10:27:43 +02:00
committed by Émilie Feral
parent 685b2a8d6d
commit edcc1f6e80

View File

@@ -251,8 +251,13 @@ IntegralLayoutNode * IntegralLayoutNode::previousNestedIntegral() {
return nullptr;
}
if (p->type() == Type::IntegralLayout) {
// Parent can be an integral
return static_cast<IntegralLayoutNode *>(p);
// Parent is an integral. Checking if the child is its integrand or not
if (p->childAtIndex(0) == this) {
return static_cast<IntegralLayoutNode *>(p);
} else {
// If this is not parent's integrand, it means that it is either a bound or differential
return nullptr;
}
} else if (p->type() == Type::HorizontalLayout) {
// Or can be a Horizontal layout himself contained in an integral
LayoutNode * prev = p->parent();