Skip to content

Commit

Permalink
fix(navcontroller): filter null viewcontrollers
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Apr 20, 2017
1 parent 9732883 commit 8605672
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/navigation/nav-controller-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,13 @@ export class NavControllerBase extends Ion implements NavController {
return convertToViews(this._linker, insertViews).then((viewControllers) => {
assert(insertViews.length === viewControllers.length, 'lengths does not match');

viewControllers = viewControllers.filter(v => v !== null);
if (viewControllers.length === 0) {
throw 'invalid views to insert';
}
// Check all the inserted view are correct
for (var i = 0; i < viewControllers.length; i++) {
var view = viewControllers[i];
if (!view) {
throw 'invalid views to insert';
}
var nav = view._nav;
if (nav && nav !== this) {
throw 'inserted view was already inserted';
Expand Down

1 comment on commit 8605672

@mburger81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah 👍

Please sign in to comment.