Tidy up closing logic

This commit is contained in:
austin 2023-07-20 21:34:43 -04:00
parent e362a6af75
commit c38fe6b322
2 changed files with 6 additions and 2 deletions

View File

@ -323,7 +323,9 @@ public class Main {
running = false;
if(Globals.server != null){
Globals.server.close();
Globals.serverThread.interrupt();
if(Globals.serverThread != null){
Globals.serverThread.interrupt();
}
}
//shut down audio engine
if(!Globals.HEADLESS && Globals.RUN_CLIENT){

View File

@ -76,7 +76,9 @@ public class Server implements Runnable{
public void close(){
try {
serverSocket.close();
if(serverSocket != null){
serverSocket.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}