From ec9ee1d37f53d189c9e91407703fee16d02f4652 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 21 Aug 2014 20:30:24 -0500 Subject: [PATCH] Wrap socket callbacks in try-catch, fix mediaUpdate remove video --- www/js/callbacks.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/www/js/callbacks.js b/www/js/callbacks.js index f8946ae4..eef13e18 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -893,7 +893,7 @@ Callbacks = { }, mediaUpdate: function(data) { - if ($("body").hasClass("chatOnly")) { + if ($("body").hasClass("chatOnly") || $("#videowrap").length === 0) { return; } @@ -1071,16 +1071,22 @@ Callbacks = { } } -var SOCKET_DEBUG = true; +var SOCKET_DEBUG = false; setupCallbacks = function() { for(var key in Callbacks) { (function(key) { - socket.on(key, function(data) { - if (SOCKET_DEBUG) { - console.log(key, data); - } - Callbacks[key](data); - }); + socket.on(key, function(data) { + if (SOCKET_DEBUG) { + console.log(key, data); + } + try { + Callbacks[key](data); + } catch (e) { + if (SOCKET_DEBUG) { + console.log("EXCEPTION: " + e.stack); + } + } + }); })(key); } }