Skip to content

Commit 523048f

Browse files
committed
Fixed to handle startConnection and finishConnection undefined exceptions
1 parent bc31e9f commit 523048f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/realtime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function finishConnection(socket, note, user) {
260260

261261
//clear finished socket in queue
262262
for (var i = 0; i < connectionSocketQueue.length; i++) {
263-
if (connectionSocketQueue[i].id == socket.id)
263+
if (!connectionSocketQueue[i] || connectionSocketQueue[i].id == socket.id)
264264
connectionSocketQueue.splice(i, 1);
265265
}
266266
//seek for next socket
@@ -386,7 +386,7 @@ function disconnect(socket) {
386386

387387
//clear finished socket in queue
388388
for (var i = 0; i < disconnectSocketQueue.length; i++) {
389-
if (disconnectSocketQueue[i].id == socket.id)
389+
if (!disconnectSocketQueue[i] || disconnectSocketQueue[i].id == socket.id)
390390
disconnectSocketQueue.splice(i, 1);
391391
}
392392
//seek for next socket

0 commit comments

Comments
 (0)