From b36e41f7fa4cc97248027402b60ba11a0bfdb64c Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Fri, 2 Oct 2020 17:45:00 +0300 Subject: [PATCH] Properly handle zero length strings when trimming --- src/main/java/eu/svjatoslav/commons/string/String2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/svjatoslav/commons/string/String2.java b/src/main/java/eu/svjatoslav/commons/string/String2.java index 8d7273d..c18633a 100755 --- a/src/main/java/eu/svjatoslav/commons/string/String2.java +++ b/src/main/java/eu/svjatoslav/commons/string/String2.java @@ -86,7 +86,7 @@ public class String2 { if (actualCutAmount > getLength()) actualCutAmount = getLength(); - chars.subList(0, actualCutAmount).clear(); + if (actualCutAmount > 0) chars.subList(0, actualCutAmount).clear(); return this; } -- 2.20.1