[zoom] Fix some potential crashes when zooming.

Generally just being a little more defensive against
potential errors.
This commit is contained in:
Andy Williams 2016-01-31 09:01:44 +00:00
parent ca96a35da7
commit 459cf7383d
1 changed files with 6 additions and 1 deletions

View File

@ -652,6 +652,9 @@ termpty_line_length(const Termcell *cells, ssize_t nb_cells)
{
ssize_t len = nb_cells;
if (!cells)
return 0;
for (len = nb_cells - 1; len >= 0; len--)
{
const Termcell *cell = cells + len;
@ -784,9 +787,11 @@ termpty_row_length(Termpty *ty, int y)
ssize_t wret;
Termcell *cells = termpty_cellrow_get(ty, y, &wret);
if (cells)
return 0;
if (y >= 0)
return termpty_line_length(cells, ty->w);
return cells ? wret : 0;
return wret;
}
ssize_t