Skip to content

Commit b33e367

Browse files
committed
Terminal: Fix crash when scrolling contents while cursor is on first row.
1 parent cfa197f commit b33e367

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Terminal/Terminal.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ Rect Terminal::row_rect(word row)
418418

419419
inline Terminal::Attribute& Terminal::attribute_at(word row, word column)
420420
{
421+
ASSERT(row < m_rows);
422+
ASSERT(column < m_columns);
421423
return m_attributes[(row * m_columns) + column];
422424
}
423425

@@ -440,7 +442,7 @@ void Terminal::paint()
440442
scanlines_to_copy * m_pixel_width
441443
);
442444
m_need_full_invalidation = true;
443-
attribute_at(m_cursor_row - m_rows_to_scroll_backing_store, m_cursor_column).dirty = true;
445+
attribute_at(max(0, m_cursor_row - m_rows_to_scroll_backing_store), m_cursor_column).dirty = true;
444446
}
445447
m_rows_to_scroll_backing_store = 0;
446448
#endif

0 commit comments

Comments
 (0)