mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 23:00:45 +01:00
[poincare] Check if layout is not AllocFail when adding row after column
This commit is contained in:
@@ -161,9 +161,10 @@ void MatrixLayoutNode::moveCursorVertically(VerticalDirection direction, LayoutC
|
||||
|
||||
void MatrixLayoutNode::newRowOrColumnAtIndex(int index) {
|
||||
assert(index >= 0 && index < m_numberOfColumns*m_numberOfRows);
|
||||
LayoutRef rootRef = LayoutRef(root());
|
||||
bool shouldAddNewRow = childIsBottomOfGrid(index); // We need to compute this boolean before modifying the layout
|
||||
int correspondingRow = rowAtChildIndex(index);
|
||||
if (childIsRightOfGrid(index)) {
|
||||
if (childIsRightOfGrid(index)) {
|
||||
// Color the grey EmptyLayouts of the column in yellow.
|
||||
int correspondingColumn = m_numberOfColumns - 1;
|
||||
for (int i = 0; i < m_numberOfRows - 1; i++) {
|
||||
@@ -175,6 +176,9 @@ void MatrixLayoutNode::newRowOrColumnAtIndex(int index) {
|
||||
// Add a column of grey EmptyLayouts on the right.
|
||||
addEmptyColumn(EmptyLayoutNode::Color::Grey);
|
||||
}
|
||||
if (rootRef.isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
if (shouldAddNewRow) {
|
||||
// Color the grey EmptyLayouts of the row in yellow.
|
||||
for (int i = 0; i < m_numberOfColumns - 1; i++) {
|
||||
|
||||
Reference in New Issue
Block a user