Skip to content

Commit

Permalink
Merge pull request #10833 from paveldk/pkolev/fix-terminated-worker
Browse files Browse the repository at this point in the history
Fix sending message to terminated worker
  • Loading branch information
alexdima authored Aug 29, 2016
2 parents b15d8ec + b241866 commit f954045
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/vs/base/common/worker/workerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ export class WorkerClient {
}

private _postMessage(msg:any): void {
this._worker.postMessage(stringify(msg));
if (this._worker) {
this._worker.postMessage(stringify(msg));
}
}

private _onSerializedMessage(msg:string): void {
Expand Down
4 changes: 3 additions & 1 deletion src/vs/base/worker/defaultWorkerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class WebWorker implements IWorker {
}

public postMessage(msg:string): void {
this.worker.postMessage(msg);
if (this.worker) {
this.worker.postMessage(msg);
}
}

public dispose(): void {
Expand Down

0 comments on commit f954045

Please sign in to comment.