diff --git a/public/hft/0.x.x/scripts/virtualsocket.js b/public/hft/0.x.x/scripts/virtualsocket.js index efa6b242..dc87723a 100644 --- a/public/hft/0.x.x/scripts/virtualsocket.js +++ b/public/hft/0.x.x/scripts/virtualsocket.js @@ -98,7 +98,14 @@ define(function() { sendLowLevel('P'); return; } - fn(JSON.parse(event.data)); + try { + var obj = JSON.parse(event.data); + } catch (e) { + console.log(e); + } + if (obj) { + fn(obj); + } }; break; } diff --git a/server/websocketserver.js b/server/websocketserver.js index bb8a62e5..bb72136e 100644 --- a/server/websocketserver.js +++ b/server/websocketserver.js @@ -93,7 +93,11 @@ var WSServer = function(server) { return; } if (origFn) { - origFn(JSON.parse(data)); + try { + origFn(JSON.parse(data)); + } catch (e) { + console.error(e); + } } }; }(fn);