Skip to content

Commit

Permalink
Fix: avoid server crash when no value is found (#29069) (#29105)
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera authored Jan 22, 2019
1 parent 5de4f1c commit 517b6dd
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 517b6dd

Please sign in to comment.