Skip to content

Commit 3f43899

Browse files
author
Ives van Hoorne
committed
Add a check for terminating workers
1 parent fb58171 commit 3f43899

File tree

1 file changed

+9
-3
lines changed
  • src/app/components/sandbox/CodeEditor

1 file changed

+9
-3
lines changed

src/app/components/sandbox/CodeEditor/Monaco.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,15 @@ export default class CodeEditor extends React.PureComponent<Props, State> {
692692
if (this.editor) {
693693
this.editor.dispose();
694694
}
695-
this.syntaxWorker.terminate();
696-
this.lintWorker.terminate();
697-
this.typingsFetcherWorker.terminate();
695+
if (this.syntaxWorker) {
696+
this.syntaxWorker.terminate();
697+
}
698+
if (this.lintWorker) {
699+
this.lintWorker.terminate();
700+
}
701+
if (this.typingsFetcherWorker) {
702+
this.typingsFetcherWorker.terminate();
703+
}
698704
clearTimeout(this.sizeProbeInterval);
699705
}
700706

0 commit comments

Comments
 (0)