Fixed to handle startConnection and finishConnection undefined exceptions

This commit is contained in:
Wu Cheng-Han 2015-09-25 16:57:18 +08:00
parent bc31e9fe3b
commit 523048f111

View file

@ -260,7 +260,7 @@ function finishConnection(socket, note, user) {
//clear finished socket in queue
for (var i = 0; i < connectionSocketQueue.length; i++) {
if (connectionSocketQueue[i].id == socket.id)
if (!connectionSocketQueue[i] || connectionSocketQueue[i].id == socket.id)
connectionSocketQueue.splice(i, 1);
}
//seek for next socket
@ -386,7 +386,7 @@ function disconnect(socket) {
//clear finished socket in queue
for (var i = 0; i < disconnectSocketQueue.length; i++) {
if (disconnectSocketQueue[i].id == socket.id)
if (!disconnectSocketQueue[i] || disconnectSocketQueue[i].id == socket.id)
disconnectSocketQueue.splice(i, 1);
}
//seek for next socket