DroidFish: Fixed NPE when shutting down program while trying to contact a network engine.

This commit is contained in:
Peter Osterlund
2012-08-19 16:17:28 +00:00
parent 31d6c0f768
commit db704232df

View File

@@ -244,8 +244,10 @@ public class NetworkEngine extends UCIEngineBase {
isRunning = false; isRunning = false;
if (startupThread != null) if (startupThread != null)
startupThread.interrupt(); startupThread.interrupt();
try { socket.getOutputStream().write("quit\n".getBytes()); } catch (IOException e) {} if (socket != null) {
try { socket.close(); } catch (IOException e) {} try { socket.getOutputStream().write("quit\n".getBytes()); } catch (IOException e) {}
try { socket.close(); } catch (IOException e) {}
}
super.shutDown(); super.shutDown();
if (stdOutThread != null) if (stdOutThread != null)
stdOutThread.interrupt(); stdOutThread.interrupt();