From cce920d252de779b83760c261648872f409fbb81 Mon Sep 17 00:00:00 2001 From: vthinkxie Date: Sat, 13 Jul 2019 16:20:47 +0800 Subject: [PATCH] fix(module:dropdown): fix dropdown contextmenu (#3782) close #3768 --- components/dropdown/nz-context-menu.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/dropdown/nz-context-menu.service.ts b/components/dropdown/nz-context-menu.service.ts index 2d030de8aef..8430356c35a 100644 --- a/components/dropdown/nz-context-menu.service.ts +++ b/components/dropdown/nz-context-menu.service.ts @@ -44,11 +44,13 @@ export class NzContextMenuService { } close(): void { - this.overlayRef.detach(); - this.setOpenState(false); - this.clickOutsideSubscription.unsubscribe(); - this.clickMenuSubscription.unsubscribe(); - this.positionSubscription.unsubscribe(); + if (this.overlayRef) { + this.overlayRef.detach(); + this.setOpenState(false); + this.clickOutsideSubscription.unsubscribe(); + this.clickMenuSubscription.unsubscribe(); + this.positionSubscription.unsubscribe(); + } } private handleClickOutside(): void {