Terminal: Fix assert

Trying to fetch a cell outside the valid range did trigger an
assert.

Change-Id: I5ac3d78aa2249d1559e7603c9e4a9bcea4d0b563
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-05-15 16:24:13 +02:00
parent 9ff0cf7306
commit a3e9fc37ba

View File

@@ -20,12 +20,12 @@ CellIterator::CellIterator(const TerminalSurface *surface, int pos)
m_maxpos = surface->fullSize().width() * (surface->fullSize().height()) - 1;
m_pos = qMax(0, qMin(m_maxpos + 1, pos));
if (m_pos == 0)
if (m_pos == 0) {
m_state = State::BEGIN;
else if (m_pos == m_maxpos + 1)
updateChar();
} else if (m_pos == m_maxpos + 1) {
m_state = State::END;
updateChar();
}
}
CellIterator::CellIterator(const TerminalSurface *surface)