diff --git a/apps/variable_box_controller.cpp b/apps/variable_box_controller.cpp index 36b9845c3..2d6d09e19 100644 --- a/apps/variable_box_controller.cpp +++ b/apps/variable_box_controller.cpp @@ -236,20 +236,20 @@ Layout VariableBoxController::expressionLayoutForRecord(Storage::Record record, assert(m_firstMemoizedLayoutIndex >= 0); } assert(index >= m_firstMemoizedLayoutIndex && index < m_firstMemoizedLayoutIndex + k_maxNumberOfDisplayedRows); - Layout result; if (m_layouts[index-m_firstMemoizedLayoutIndex].isUninitialized()) { /* Creating the layout of a very long variable might throw a pool exception. * We want to catch it and return a dummy layout instead, otherwise the user * won't be able to open the variable box again, until she deletes the * problematic variable -> and she has no help to remember its name, as she * can't open the variable box. */ + Layout result; Poincare::ExceptionCheckpoint ecp; if (ExceptionRun(ecp)) { result = GlobalContext::LayoutForRecord(record); } + m_layouts[index-m_firstMemoizedLayoutIndex] = result; } - m_layouts[index-m_firstMemoizedLayoutIndex] = result; - return result; + return m_layouts[index-m_firstMemoizedLayoutIndex]; } const char * VariableBoxController::extension() const {