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
wilder
Luis Javier Merino Morán 5 years ago committed by Kurt Hindenburg
parent e245610e87
commit d5b290aa48
  1. 2
      src/Screen.cpp

@ -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;

Loading…
Cancel
Save