termiointernals: fix possible NULL-dereference. CID1399748

This commit is contained in:
Boris Faure 2019-03-18 23:05:06 +01:00
parent 485d7a3edf
commit 9785beaef0
1 changed files with 3 additions and 3 deletions

View File

@ -427,9 +427,9 @@ _sel_line(Termio *sd, int cy)
}
/* Right trim */
x = sd->pty->selection.end.x;
while (x > 0 && ((cells[x].codepoint == 0) ||
(cells[x].codepoint == ' ') ||
(cells[x].att.newline)))
while ((x > 0) && (cells != NULL) && ((cells[x].codepoint == 0) ||
(cells[x].codepoint == ' ') ||
(cells[x].att.newline)))
{
x--;
}