From 82bd729523136ebea4c484fe47f90b22b5c20f0b Mon Sep 17 00:00:00 2001 From: Wendell Date: Wed, 14 Aug 2019 09:23:56 +0800 Subject: [PATCH] fix(module:editor): fix destroying error when editor is not initialized --- components/code-editor/nz-code-editor.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/code-editor/nz-code-editor.component.ts b/components/code-editor/nz-code-editor.component.ts index 891b25e46bd..6175fa6281f 100644 --- a/components/code-editor/nz-code-editor.component.ts +++ b/components/code-editor/nz-code-editor.component.ts @@ -99,7 +99,9 @@ export class NzCodeEditorComponent implements OnDestroy, AfterViewInit { } ngOnDestroy(): void { - this.editorInstance.dispose(); + if (this.editorInstance) { + this.editorInstance.dispose(); + } this.destroy$.next(); this.destroy$.complete();