From bc8a29fcf385b91d0cf6e156fb002776ca9c31a4 Mon Sep 17 00:00:00 2001 From: Hiers Date: Fri, 17 Feb 2023 11:41:38 +0000 Subject: [PATCH] Fix buffer underflow bug in output line counter. --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 504e560..3bc605e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,7 +120,9 @@ fn main() -> Result<(), ureq::Error> { lines_output += 1; } output.pop(); - lines_output -= 1; + if lines_output > 0 { + lines_output -= 1; + } if lines_output >= term_size - 1 && term_size != 0{ /* output is a different process that is not a tty (i.e. less), but we want to keep colour */