Do not free more lines than are available in the history.

This commit is contained in:
nicm
2017-09-11 06:40:46 +00:00
parent 70bc07a358
commit 6fdaaa0637

4
grid.c
View File

@ -292,12 +292,14 @@ grid_collect_history(struct grid *gd)
{ {
u_int ny; u_int ny;
if (gd->hsize < gd->hlimit) if (gd->hsize == 0 || gd->hsize < gd->hlimit)
return; return;
ny = gd->hlimit / 10; ny = gd->hlimit / 10;
if (ny < 1) if (ny < 1)
ny = 1; ny = 1;
if (ny > gd->hsize)
ny = gd->hsize;
/* /*
* Free the lines from 0 to ny then move the remaining lines over * Free the lines from 0 to ny then move the remaining lines over