diff --git a/www/code/main.js b/www/code/main.js index 13bd3d552..8595d3b2e 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -552,9 +552,15 @@ define([ var userDoc = module.realtime.getUserDoc(); + var newDoc = ""; if(userDoc !== "") { var hjson = JSON.parse(userDoc); + + if (typeof (hjson) !== 'object' || Array.isArray(hjson)) { + throw new Error("That realtime document is not compatible with the Code app"); + } + newDoc = hjson.content; if (hjson.highlightMode) { diff --git a/www/slide/main.js b/www/slide/main.js index cd69a64f9..5e8a9f41a 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -630,6 +630,10 @@ define([ var hjson = JSON.parse(userDoc); newDoc = hjson.content; + if (typeof (hjson) !== 'object' || Array.isArray(hjson)) { + throw new Error("That realtime document is not compatible with the Slide app"); + } + if (hjson.highlightMode) { setMode(hjson.highlightMode, module.$language); }