From a076b7742d33c1a02cf301bee0434f2ee3db3b75 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 8 Jun 2020 09:33:13 +0200 Subject: [PATCH] =?UTF-8?q?Add=20guards=20to=20catch=20null=20arguments=20?= =?UTF-8?q?in=20AsyncConnectionProvider.forEach(=E2=80=A6)=20#1301?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lettuce/core/internal/AsyncConnectionProvider.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java b/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java index 8d573a98e4..73457603ae 100644 --- a/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java +++ b/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java @@ -187,7 +187,14 @@ public void close(K key) { * @param action the action. */ public void forEach(Consumer action) { - connections.values().forEach(sync -> sync.doWithConnection(action)); + + LettuceAssert.notNull(action, "Action must not be null!"); + + connections.values().forEach(sync -> { + if (sync != null) { + sync.doWithConnection(action); + } + }); } /**