summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-07-14 20:54:04 -0400
committerJakob Kaivo <jkk@ung.org>2020-07-14 20:54:04 -0400
commit7ca612506a90802b7e1e9dd02cdabfef8cf0c74d (patch)
tree20958750fb11bb8eb603534f588873eda19252b1
parent901991d79a972f9744758e3884a882db1c67c2aa (diff)
don't try to scroll past end of file
-rw-r--r--more.c4
1 files changed, 3 insertions, 1 deletions
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);
}
}