[fix]NPE when pub message is null

Signed-off-by: 默其妙 <rugtee@outlook.com>
pull/4773/head
默其妙 2 years ago
parent 69b71104cf
commit bb656c9633

@ -31,10 +31,7 @@
*/
package org.redisson.client.handler;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.buffer.*;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
@ -117,6 +114,9 @@ public class CommandEncoder extends MessageToByteEncoder<CommandData<?, ?>> {
}
private ByteBuf encode(Object in) {
if (in == null) {
return new EmptyByteBuf(ByteBufAllocator.DEFAULT);
}
if (in instanceof byte[]) {
return Unpooled.wrappedBuffer((byte[]) in);
}

Loading…
Cancel
Save