From e1f9b7a0591fe97f3e91cb853bed9024985ea664 Mon Sep 17 00:00:00 2001 From: Ilya Surmay Date: Wed, 4 Oct 2017 17:44:38 +0300 Subject: [PATCH] fix(modal): add null check in focusOtherModal() closes #2612 --- src/modal/modal.directive.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modal/modal.directive.ts b/src/modal/modal.directive.ts index fcf97a1e37..b50cfa21cc 100644 --- a/src/modal/modal.directive.ts +++ b/src/modal/modal.directive.ts @@ -371,9 +371,8 @@ export class ModalDirective implements OnDestroy, OnInit { // } protected focusOtherModal() { - const otherOpenedModals = this._element.nativeElement.parentElement.querySelectorAll( - '.in[bsModal]' - ); + if (this._element.nativeElement.parentElement == null) return; + const otherOpenedModals = this._element.nativeElement.parentElement.querySelectorAll('.in[bsModal]'); if (!otherOpenedModals.length) { return; }