diff options
author | Wu Cheng-Han | 2015-07-12 17:19:07 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-07-12 17:19:07 +0800 |
commit | bbcc64af6b8e610f09a845c940c930d4d91a12f4 (patch) | |
tree | 2185faaa7e2a69919bcb77ffee8ff55b12f7e7a5 | |
parent | f359044776ae3e4e499bb3311034c84a4b554347 (diff) |
Handle an server getNotenameFromSocket referer undefined exception
-rw-r--r-- | lib/realtime.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/realtime.js b/lib/realtime.js index 66a3c9c5..3e367158 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -151,7 +151,11 @@ function getStatus(callback) { } function getNotenameFromSocket(socket) { - var hostUrl = url.parse(socket.handshake.headers.referer); + var referer = socket.handshake.headers.referer; + if (!referer) { + return socket.disconnect(); + } + var hostUrl = url.parse(referer); var notename = hostUrl.pathname.split('/')[1]; if (notename == config.featuresnotename) { return notename; |