[#1159] Make sure we not produce an empty buffer on decodeLast(..)

This commit is contained in:
Norman Maurer 2013-03-14 13:42:02 +01:00
parent afdac5611e
commit 33c988b129

View File

@ -134,7 +134,11 @@ public class HttpClientCodec implements ChannelUpstreamHandler,
protected Object decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buffer, State state) throws Exception {
if (done) {
return buffer.readBytes(actualReadableBytes());
int readable = actualReadableBytes();
if (readable == 0) {
return null;
}
return buffer.readBytes(readable);
} else {
Object msg = super.decode(ctx, channel, buffer, state);
if (failOnMissingResponse) {