summaryrefslogtreecommitdiff
path: root/lib/realtime.js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-25 16:57:18 +0800
committerWu Cheng-Han2015-09-25 16:57:18 +0800
commit523048f111250b92ab64b694941fdec487ef306e (patch)
treec563a94bc3d64724b6d263485345faf4b2fff938 /lib/realtime.js
parentbc31e9fe3b5a720c369826fe959f9830b98c2ccc (diff)
Fixed to handle startConnection and finishConnection undefined exceptions
Diffstat (limited to 'lib/realtime.js')
-rw-r--r--lib/realtime.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index af33cadf..86d361ef 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -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