diff --git a/transport/src/main/java/io/netty/channel/MessageList.java b/transport/src/main/java/io/netty/channel/MessageList.java index 11a83ef25c..e63123d880 100644 --- a/transport/src/main/java/io/netty/channel/MessageList.java +++ b/transport/src/main/java/io/netty/channel/MessageList.java @@ -267,13 +267,14 @@ public final class MessageList implements Iterable { int i = srcIdx; try { if (byteBufsOnly) { - for (; i < srcEndIdx; i ++) { + while (i < srcEndIdx) { T m = src[srcIdx]; if (m == null) { throw new NullPointerException("src[" + srcIdx + ']'); } elements[dstIdx ++] = m; + i ++; if (!(m instanceof ByteBuf)) { byteBufsOnly = false; @@ -297,7 +298,7 @@ public final class MessageList implements Iterable { } } - assert dstIdx == newSize; + assert dstIdx == newSize : String.format("dstIdx(%d) != newSize(%d)", dstIdx, newSize); size = newSize; return this;