diff --git a/escher/src/scrollable_expression_view_with_cursor.cpp b/escher/src/scrollable_expression_view_with_cursor.cpp index fd0f07a1b..c80e887a8 100644 --- a/escher/src/scrollable_expression_view_with_cursor.cpp +++ b/escher/src/scrollable_expression_view_with_cursor.cpp @@ -199,7 +199,7 @@ void ScrollableExpressionViewWithCursor::insertLayoutAtCursor(Poincare::Expressi return; } KDSize previousSize = minimalSizeForOptimalDisplay(); - if (layout->isMatrix() && pointedLayout->hasAncestor(layout)) { + if (layout->isMatrix() && pointedLayout && pointedLayout->hasAncestor(layout)) { static_cast(layout)->addGreySquares(); } if (pointedLayout != nullptr) {