Skip to content

Commit 6d3ddfe

Browse files
committed
Handle failure scenarios better.
1 parent dd9f034 commit 6d3ddfe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

playground/next/editor.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,13 @@ window.app = createApp({
564564
},
565565
gatherHash() {
566566
const url = new URL(window.location);
567-
const hash = new URLSearchParams(url.hash.slice(1));
568-
this.contextDoc = JSON.parse(hash.get('context') || {});
567+
const hash = new URLSearchParams(url?.hash.slice(1));
568+
this.contextDoc = JSON.parse(hash.get('context')) || {};
569569
setEditorValue(this.contextEditor, this.contextDoc);
570-
this.frameDoc = JSON.parse(hash.get('frame') || {});
570+
this.frameDoc = JSON.parse(hash.get('frame')) || {};
571571
setEditorValue(this.frameEditor, this.frameDoc);
572-
this.doc = JSON.parse(hash.get('json-ld') || {});
572+
this.doc = JSON.parse(hash.get('json-ld')) || {};
573573
setEditorValue(this.mainEditor, this.doc);
574-
this.outputTab = hash.get('startTab').slice(4);
574+
this.outputTab = hash.get('startTab')?.slice(4);
575575
}
576576
}).mount();

0 commit comments

Comments
 (0)