diff --git a/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java b/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java index 9761287..9eac20a 100644 --- a/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java +++ b/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java @@ -62,6 +62,7 @@ public class ChatWindowController { private void connect() { try { messages.clear(); // clear message list + redrawMessageList(); startConnectionHandler(); connectionHandler.connect(); } catch(ChatProtocolException | IOException e) { diff --git a/client/src/main/java/ch/zhaw/pm2/multichat/client/Message.java b/client/src/main/java/ch/zhaw/pm2/multichat/client/Message.java index c1ed9c6..3506943 100644 --- a/client/src/main/java/ch/zhaw/pm2/multichat/client/Message.java +++ b/client/src/main/java/ch/zhaw/pm2/multichat/client/Message.java @@ -14,9 +14,9 @@ public class Message { } public boolean matchesFilter(String filter){ - return sender.contains(filter) || - receiver.contains(filter) || - text.contains(filter); + return (sender != null && sender.contains(filter)) || + (receiver != null && receiver.contains(filter)) || + (text != null && text.contains(filter)); } public MessageType getType() {