Skip to content

Commit

Permalink
fix(): make sure editor is instantiated before disposing (#68)
Browse files Browse the repository at this point in the history
Sometimes when editor is destroyed to quick, we get an  undefined error
  • Loading branch information
Ed Morales authored Jun 11, 2019
1 parent 7df5d9d commit 3be0008
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/platform/code-editor/code-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,11 @@ export class TdCodeEditorComponent implements OnInit, AfterViewInit, ControlValu

ngOnDestroy(): void {
this._changeDetectorRef.detach();
this._webview ? this._webview.send('dispose') : this._editor.dispose();
if (this._webview) {
this._webview.send('dispose');
} else if (this._editor) {
this._editor.dispose();
}
this._destroy.next(true);
this._destroy.unsubscribe();
}
Expand Down

0 comments on commit 3be0008

Please sign in to comment.