diff --git a/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java b/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java index 163299711e..4614405ade 100644 --- a/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java +++ b/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java @@ -144,7 +144,9 @@ public CompletableFuture close() { for (K k : connections.keySet()) { Sync remove = connections.remove(k); - remove.doWithConnection(e -> futures.add(e.closeAsync())); + if (remove != null) { + remove.doWithConnection(e -> futures.add(e.closeAsync())); + } } return Futures.allOf(futures);