diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index f14ddd0..eb8fd84 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -77,8 +77,10 @@ public class ChatClient extends JFrame implements KeyListener { } } - toServerWriter.close(); - + if(null != toServerWriter) { + toServerWriter.close(); + } + } }