From c313962584628dabdba08b53a62efe0071d26b4b Mon Sep 17 00:00:00 2001 From: Alex Klein Date: Tue, 15 Aug 2017 13:30:09 +0200 Subject: [PATCH] fix: error with OutsideEventPlugin that would lead to calling undefined function (#379) Fixes #239 --- src/ngx-modialog/src/providers/outside-event-plugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ngx-modialog/src/providers/outside-event-plugin.ts b/src/ngx-modialog/src/providers/outside-event-plugin.ts index aa2160fd..eee3991d 100644 --- a/src/ngx-modialog/src/providers/outside-event-plugin.ts +++ b/src/ngx-modialog/src/providers/outside-event-plugin.ts @@ -81,7 +81,9 @@ export class DOMOutsideEventPlugin { // extends EventManagerPlugin return zone.runOutsideAngular(() => { let fn: Function; setTimeout(() => fn = onceOnOutside(), 0); - return () => fn(); + return () => { + if (fn) fn(); + }; }); }