diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 851ef84..f14ddd0 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -69,10 +69,12 @@ public class ChatClient extends JFrame implements KeyListener { } } - try { - fromServerReader.close(); - } catch (IOException e) { - e.printStackTrace(); + if (null != fromServerReader) { + try { + fromServerReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } } toServerWriter.close();