Skip to content

Commit 8605672

Browse files
committed
fix(navcontroller): filter null viewcontrollers
1 parent 9732883 commit 8605672

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/navigation/nav-controller-base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,13 @@ export class NavControllerBase extends Ion implements NavController {
341341
return convertToViews(this._linker, insertViews).then((viewControllers) => {
342342
assert(insertViews.length === viewControllers.length, 'lengths does not match');
343343

344+
viewControllers = viewControllers.filter(v => v !== null);
345+
if (viewControllers.length === 0) {
346+
throw 'invalid views to insert';
347+
}
344348
// Check all the inserted view are correct
345349
for (var i = 0; i < viewControllers.length; i++) {
346350
var view = viewControllers[i];
347-
if (!view) {
348-
throw 'invalid views to insert';
349-
}
350351
var nav = view._nav;
351352
if (nav && nav !== this) {
352353
throw 'inserted view was already inserted';

0 commit comments

Comments
 (0)