@@ -550,21 +550,23 @@ function($rootScope, $state, $location, $window, $injector, $animate, $ionicNavV
550
550
histories = $rootScope . $viewHistory . histories ,
551
551
currentView = $rootScope . $viewHistory . currentView ;
552
552
553
- for ( var historyId in histories ) {
553
+ if ( histories ) {
554
+ for ( var historyId in histories ) {
554
555
555
- if ( histories [ historyId ] . stack ) {
556
- histories [ historyId ] . stack = [ ] ;
557
- histories [ historyId ] . cursor = - 1 ;
558
- }
556
+ if ( histories [ historyId ] . stack ) {
557
+ histories [ historyId ] . stack = [ ] ;
558
+ histories [ historyId ] . cursor = - 1 ;
559
+ }
559
560
560
- if ( currentView . historyId === historyId ) {
561
- currentView . backViewId = null ;
562
- currentView . forwardViewId = null ;
563
- histories [ historyId ] . stack . push ( currentView ) ;
564
- } else if ( histories [ historyId ] . destroy ) {
565
- histories [ historyId ] . destroy ( ) ;
566
- }
561
+ if ( currentView && currentView . historyId === historyId ) {
562
+ currentView . backViewId = null ;
563
+ currentView . forwardViewId = null ;
564
+ histories [ historyId ] . stack . push ( currentView ) ;
565
+ } else if ( histories [ historyId ] . destroy ) {
566
+ histories [ historyId ] . destroy ( ) ;
567
+ }
567
568
569
+ }
568
570
}
569
571
570
572
for ( var viewId in $rootScope . $viewHistory . views ) {
@@ -573,7 +575,9 @@ function($rootScope, $state, $location, $window, $injector, $animate, $ionicNavV
573
575
}
574
576
}
575
577
576
- this . setNavViews ( currentView . viewId ) ;
578
+ if ( currentView ) {
579
+ this . setNavViews ( currentView . viewId ) ;
580
+ }
577
581
}
578
582
579
583
} ;
0 commit comments