diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-07-14 20:54:04 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-07-14 20:54:04 -0400 |
commit | 7ca612506a90802b7e1e9dd02cdabfef8cf0c74d (patch) | |
tree | 20958750fb11bb8eb603534f588873eda19252b1 | |
parent | 901991d79a972f9744758e3884a882db1c67c2aa (diff) |
don't try to scroll past end of file
-rw-r--r-- | more.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } } |