diff --git a/src/legacy/core_plugins/interpreter/server/lib/route_expression/thread/index.js b/src/legacy/core_plugins/interpreter/server/lib/route_expression/thread/index.js index 942d0c66dc813..d16e207b6bb53 100644 --- a/src/legacy/core_plugins/interpreter/server/lib/route_expression/thread/index.js +++ b/src/legacy/core_plugins/interpreter/server/lib/route_expression/thread/index.js @@ -37,12 +37,14 @@ export function getWorker() { if (type === 'run') { const { threadId } = msg; const { ast, context } = value; - heap[threadId] - .onFunctionNotFound(ast, context) - .then(value => { - worker.send({ type: 'msgSuccess', id, value: value }); - }) - .catch(e => heap[threadId].reject(e)); + if (heap[threadId]) { + heap[threadId] + .onFunctionNotFound(ast, context) + .then(value => { + worker.send({ type: 'msgSuccess', id, value: value }); + }) + .catch(e => heap[threadId].reject(e)); + } } if (type === 'msgSuccess' && heap[id]) heap[id].resolve(value);