🐛 Only evaluate the message function once
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Wed, 4 Sep 2024 11:47:10 +0000 (13:47 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Wed, 4 Sep 2024 11:47:10 +0000 (13:47 +0200)
src/test/java/net/pterodactylus/fcp/highlevel/FcpClientTest.java

index cf0ddd2..3d9a660 100644 (file)
@@ -204,7 +204,8 @@ public class FcpClientTest {
 
                        @Override
                        public void sendMessage(FcpMessage fcpMessage) {
-                               listeners.forEach(listener -> messageConsumer.apply(fcpMessage).accept(listener, this));
+                               BiConsumer<FcpListener, FcpConnection> listenerNotifier = messageConsumer.apply(fcpMessage);
+                               listeners.forEach(listener -> listenerNotifier.accept(listener, this));
                        }
                };
        }