From 7ca612506a90802b7e1e9dd02cdabfef8cf0c74d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 14 Jul 2020 20:54:04 -0400 Subject: don't try to scroll past end of file --- more.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/more.c b/more.c index ca434c3..253bbc5 100644 --- a/more.c +++ b/more.c @@ -47,7 +47,9 @@ void scroll(const struct more_tty *mt, struct more_file *mf, int count, int mult /* FIXME: account for long lines here, too */ mf->topline++; - more_getline(mf, mf->topline + mt->lines + 1); + if (more_getline(mf, mf->topline + mt->lines + 1) < 0) { + break; + } printf("%s", mf->buf); } } -- cgit v1.2.1