fixed matchesFilter in Message.java

Problem solved if any String is null.
This commit is contained in:
schrom01 2022-04-12 11:01:28 +02:00
parent 3082da8a91
commit 7e7333dfaf
2 changed files with 4 additions and 3 deletions

View File

@ -62,6 +62,7 @@ public class ChatWindowController {
private void connect() { private void connect() {
try { try {
messages.clear(); // clear message list messages.clear(); // clear message list
redrawMessageList();
startConnectionHandler(); startConnectionHandler();
connectionHandler.connect(); connectionHandler.connect();
} catch(ChatProtocolException | IOException e) { } catch(ChatProtocolException | IOException e) {

View File

@ -14,9 +14,9 @@ public class Message {
} }
public boolean matchesFilter(String filter){ public boolean matchesFilter(String filter){
return sender.contains(filter) || return (sender != null && sender.contains(filter)) ||
receiver.contains(filter) || (receiver != null && receiver.contains(filter)) ||
text.contains(filter); (text != null && text.contains(filter));
} }
public MessageType getType() { public MessageType getType() {