From de322f651c864ab29cfefd888d8aaac5ff38c936 Mon Sep 17 00:00:00 2001 From: Peter Vanusanik Date: Sat, 28 Jan 2023 04:34:50 -0800 Subject: [PATCH] quickfix for nulls --- .../en_circle/slt/tools/BufferedString.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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());