From 9f1c7374151bb865fe45ded83b6925b9e962c284 Mon Sep 17 00:00:00 2001 From: Ashley Grant Date: Tue, 12 Jun 2018 14:48:33 -0400 Subject: [PATCH 1/2] fix(view-slot): add null check to removeAt --- src/view-slot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/view-slot.js b/src/view-slot.js index 9e8d2f9b..4dbdcd9a 100644 --- a/src/view-slot.js +++ b/src/view-slot.js @@ -209,7 +209,7 @@ export class ViewSlot { * @param skipAnimation Should the removal animation be skipped? * @return May return a promise if the view removal triggered an animation. */ - remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): void | Promise { + remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): void | Promise | void{ return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation); } @@ -275,9 +275,13 @@ export class ViewSlot { * @param skipAnimation Should the removal animation be skipped? * @return May return a promise if the view removal triggered an animation. */ - removeAt(index: number, returnToCache?: boolean, skipAnimation?: boolean): View | Promise { + removeAt(index: number, returnToCache?: boolean, skipAnimation?: boolean): View | Promise | void { let view = this.children[index]; + if(!view) { + return; + } + let removeAction = () => { index = this.children.indexOf(view); view.removeNodes(); From f18ff3f44f7aa64051c5f3d968bcd7c7f4b11f9d Mon Sep 17 00:00:00 2001 From: Ashley Grant Date: Tue, 12 Jun 2018 15:29:42 -0400 Subject: [PATCH 2/2] fix(view-slot): update return type of remove function --- src/view-slot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view-slot.js b/src/view-slot.js index 4dbdcd9a..65976e7e 100644 --- a/src/view-slot.js +++ b/src/view-slot.js @@ -209,7 +209,7 @@ export class ViewSlot { * @param skipAnimation Should the removal animation be skipped? * @return May return a promise if the view removal triggered an animation. */ - remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): void | Promise | void{ + remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): void | Promise | View{ return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation); }