diff --git a/src/main/java/com/en_circle/slt/tools/BufferedString.java b/src/main/java/com/en_circle/slt/tools/BufferedString.java index 82adcda..6c08127 100644 --- a/src/main/java/com/en_circle/slt/tools/BufferedString.java +++ b/src/main/java/com/en_circle/slt/tools/BufferedString.java @@ -33,14 +33,16 @@ private void truncateAndSet() { int diff = size - maxSize; while (!chunks.isEmpty()) { String left = chunks.removeFirst(); - if (left.length() < diff) { - diff -= left.length(); - size -= left.length(); - } else { - left = left.substring(0, left.length() - diff); - size -= diff; - chunks.addFirst(left); - break; + if (left != null) { + if (left.length() < diff) { + diff -= left.length(); + size -= left.length(); + } else { + left = left.substring(0, left.length() - diff); + size -= diff; + chunks.addFirst(left); + break; + } } } completeReset.accept(toString());