Be more cautious about parsing json.

This commit is contained in:
Paul Kaplan 2017-12-14 14:21:57 -05:00
parent 256d7b3d6c
commit 0f82e2a84d

View file

@ -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) {