scroll

scrollbackbuffer program for st
git clone git://git.suckless.org//gitrepos
Log | Files | Refs

commit faf0800f0b133607a8e3b5b807ab185c1b1c242b
parent ff2fbccd565b1f3e6f03cfc1fc4355a117af6faf
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date:   Tue, 31 Mar 2020 19:34:31 +0200

Don't segfault when scrolling down with empty scrollback

Diffstat:
Mscroll.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scroll.c b/scroll.c @@ -276,7 +276,7 @@ scrolldown(char *buf, size_t size) int rows = ws.ws_row; /* print one page */ - for (; rows > 0 && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) { + for (; rows > 0 && bottom != NULL && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) { bottom = TAILQ_PREV(bottom, tailhead, entries); write(STDOUT_FILENO, bottom->buf, bottom->size); }