Don't crash if we can't bind to server socket

This commit is contained in:
Felix Ableitner 2016-09-24 19:03:49 +09:00
parent a857002fa9
commit f579608f6b

View file

@ -23,6 +23,9 @@ class InternetServerThread(crypto: Crypto, port: Int,
} }
override def run(): Unit = { override def run(): Unit = {
if (socket.isEmpty)
return
try { try {
while (socket.get.isBound) { while (socket.get.isBound) {
val connection = new InternetConnectionThread(socket.get.accept(), crypto, onDisconnected, onReceive) val connection = new InternetConnectionThread(socket.get.accept(), crypto, onDisconnected, onReceive)