From 3082da8a91cc1b29c2c8a07a5eb95a783dceb56b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Tue, 12 Apr 2022 10:00:31 +0200 Subject: [PATCH] Solved Problem "Empty Messages can be sent" --- .../ch/zhaw/pm2/multichat/client/ClientConnectionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientConnectionHandler.java b/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientConnectionHandler.java index 7fa5a6f..fb57727 100644 --- a/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientConnectionHandler.java +++ b/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientConnectionHandler.java @@ -202,7 +202,7 @@ public class ClientConnectionHandler implements Runnable { if (state != CONNECTED) throw new ChatProtocolException("Illegal state for message: " + state); Matcher matcher = messagePattern.matcher(messageString); - if (matcher.find()) { + if (messageString != "" && matcher.find()) { String receiver = matcher.group(1); String message = matcher.group(2); if (receiver == null || receiver.isBlank()) receiver = ClientConnectionHandler.USER_ALL;