From 49445767cb94fedc0be7662a597de96d7984ab42 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 14 Jul 2013 21:58:11 -0400 Subject: [PATCH] temp fix to resolve socket js error --- public/src/app.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index 806c053444..b64a6dcf9b 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -196,15 +196,18 @@ var socket, app.current_room = null; app.enter_room = function(room) { - if (app.current_room === room) - return; - socket.emit('event:enter_room', { - 'enter': room, - 'leave': app.current_room - }); - - app.current_room = room; + if(socket) { + if (app.current_room === room) + return; + + socket.emit('event:enter_room', { + 'enter': room, + 'leave': app.current_room + }); + + app.current_room = room; + } }; app.process_page = function() {