diff --git a/common/src/main/java/io/netty/util/internal/AppendableCharSequence.java b/common/src/main/java/io/netty/util/internal/AppendableCharSequence.java index 9e4fb6d636..b0c5e9a73b 100644 --- a/common/src/main/java/io/netty/util/internal/AppendableCharSequence.java +++ b/common/src/main/java/io/netty/util/internal/AppendableCharSequence.java @@ -23,6 +23,9 @@ public final class AppendableCharSequence implements CharSequence, Appendable { private int pos; public AppendableCharSequence(int length) { + if (length < 1) { + throw new IllegalArgumentException("length: " + length + " (length: >= 1)"); + } chars = new char[length]; }