Browse Source

Check connection to server before closing

remotes/origin/feature/client/exchange-messages-between-client-server
Alena Bandarovich 11 months ago
parent
commit
efbf5ad6c8
  1. 10
      src/main/java/ChatClient.java

10
src/main/java/ChatClient.java

@ -61,10 +61,12 @@ public class ChatClient extends JFrame implements KeyListener {
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen.");
} finally {
try {
connectionToServer.close();
} catch (IOException e) {
e.printStackTrace();
if (null != connectionToServer) {
try {
connectionToServer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {

Loading…
Cancel
Save