Commit d5b290aa authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Fix potential crash in Screen::restoreCursor

Restore Y coordinate before X coordinate, so we make sure Y is in bounds
before trying to access _lineProperties depending on Y.

To test:

 - Go to the last line
 - tput sc
 - Shrink the terminal
 - tput rc
parent e245610e
......@@ -359,8 +359,8 @@ void Screen::saveCursor()
void Screen::restoreCursor()
_cuX = qMin(_savedState.cursorColumn, getScreenLineColumns(_savedState.cursorLine) - 1);
_cuY = qMin(_savedState.cursorLine, _lines - 1);
_cuX = qMin(_savedState.cursorColumn, getScreenLineColumns(_cuY) - 1);
_currentRendition = _savedState.rendition;
_currentForeground = _savedState.foreground;
_currentBackground = _savedState.background;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment