Skip to content

Commit 373113d

Browse files
committed
fix: destroy component only if it exists
Signed-off-by: Akshat Patel <[email protected]>
1 parent 83e6951 commit 373113d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/modal/base-modal.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ export class BaseModalService {
8080

8181
// Let animation finish before component is removed
8282
setTimeout(() => {
83-
this.placeholderService.destroyComponent(BaseModalService.modalList[index]);
84-
BaseModalService.modalList.splice(index, 1);
83+
if (BaseModalService.modalList[index]) {
84+
this.placeholderService.destroyComponent(BaseModalService.modalList[index]);
85+
BaseModalService.modalList.splice(index, 1);
86+
}
8587
}, 240);
8688
}
8789
}

0 commit comments

Comments
 (0)