Fix bounds issue with empty log flushes

This commit is contained in:
nathanrsxtn
2022-04-18 01:25:52 -06:00
parent dd61861549
commit 0196174180
@@ -130,7 +130,7 @@ public class AnsiLogging {
return new PrintStream(new ByteArrayOutputStream() { return new PrintStream(new ByteArrayOutputStream() {
@Override @Override
public void flush() throws IOException { public void flush() throws IOException {
String s = new String(buf, 0, strip ? count - 1 : count); String s = new String(buf, 0, strip ? Math.max(0, count - 1) : count);
if (!s.isBlank()) logger.accept(s); if (!s.isBlank()) logger.accept(s);
reset(); reset();
} }