From 0f82e2a84dfef85329655e62861057795440ddca Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Thu, 14 Dec 2017 14:21:57 -0500 Subject: [PATCH] Be more cautious about parsing json. --- src/engine/sequencer.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index faa40b9e8..2db1c6ed8 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -316,7 +316,15 @@ class Sequencer { const definitionBlock = thread.target.blocks.getBlock(definition); const innerBlock = thread.target.blocks.getBlock( definitionBlock.inputs.custom_block.block); - const doWarp = JSON.parse(innerBlock.mutation.warp); + let doWarp = false; + if (innerBlock && innerBlock.mutation) { + const warp = innerBlock.mutation.warp; + if (typeof warp === 'boolean') { + doWarp = warp; + } else if (typeof warp === 'string') { + doWarp = JSON.parse(warp); + } + } if (doWarp) { thread.peekStackFrame().warpMode = true; } else if (isRecursive) {