Skip to content

Commit a7f6f03

Browse files
committed
Add argument check to ChannelWriter.write
1 parent 868d5ba commit a7f6f03

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/main/java/com/lambdaworks/redis/cluster/ClusterDistributionChannelWriter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public ClusterDistributionChannelWriter(RedisChannelWriter<K, V> defaultWriter)
4141
@SuppressWarnings("unchecked")
4242
public <T, C extends RedisCommand<K, V, T>> C write(C command) {
4343

44+
checkArgument(command != null, "command must not be null");
45+
4446
if (closed) {
4547
throw new RedisException("Connection is closed");
4648
}

src/main/java/com/lambdaworks/redis/protocol/CommandHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
package com.lambdaworks.redis.protocol;
44

5+
import static com.google.common.base.Preconditions.checkArgument;
6+
57
import java.nio.channels.ClosedChannelException;
68
import java.nio.charset.Charset;
79
import java.util.ArrayDeque;
@@ -164,6 +166,8 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Interrup
164166
@Override
165167
public <T, C extends RedisCommand<K, V, T>> C write(C command) {
166168

169+
checkArgument(command != null, "command must not be null");
170+
167171
if (lifecycleState == LifecycleState.CLOSED) {
168172
throw new RedisException("Connection is closed");
169173
}

0 commit comments

Comments
 (0)