Skip to content

Commit

Permalink
Polishing #2444
Browse files Browse the repository at this point in the history
Guard code against potential null elements during concurrent flushing.
  • Loading branch information
mp911de committed Jul 17, 2023
1 parent 49f3930 commit 14500d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ private List<RedisCommand<Object, Object, Object>> prepareForceFlush() {

RedisCommand<Object, Object, Object> poll = queue.poll();

batch.add(poll);
if (poll != null) {
batch.add(poll);
}
}

return batch;
Expand All @@ -167,7 +169,9 @@ private List<RedisCommand<Object, Object, Object>> prepareDefaultFlush(int consu

RedisCommand<Object, Object, Object> poll = queue.poll();

batch.add(poll);
if (poll != null) {
batch.add(poll);
}
}

return batch;
Expand Down

0 comments on commit 14500d6

Please sign in to comment.