[#1671] Fix bug in ChunkedWriteHandler which produce a NPE on empty chunks
This commit is contained in:
parent
0cb3541b53
commit
00f1533fa9
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package io.netty.handler.stream;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
@ -260,6 +261,12 @@ public class ChunkedWriteHandler
|
||||
break;
|
||||
}
|
||||
|
||||
if (message == null) {
|
||||
// If message is null write an empty ByteBuf.
|
||||
// See https://github.com/netty/netty/issues/1671
|
||||
message = Unpooled.EMPTY_BUFFER;
|
||||
}
|
||||
|
||||
pendingWrites.incrementAndGet();
|
||||
ChannelFuture f = ctx.write(message);
|
||||
if (endOfInput) {
|
||||
|
Loading…
Reference in New Issue
Block a user