mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
* fix(action-bar): #5743 navController may be null From my own Crashlytics: `stderr: file:///app/vendor.js:1:860568: JS ERROR TypeError: null is not an object (evaluating 'a.viewControllers')` ``` file:///app/vendor.js:1:860489 var l,p=a.viewControllers.indexOfObject(n);if(p>0&&p<a.viewControllers.count&&(t=a.viewControllers[p-1]),t) ``` which corresponds to:2fc1d8a8d4/tns-core-modules/ui/action-bar/action-bar.ios.ts (L132)
further up `navController` is checked for truthiness:2fc1d8a8d4/tns-core-modules/ui/action-bar/action-bar.ios.ts (L119)
So applying same logic. * Adjusted per request
This commit is contained in:

committed by
Nikolay Tsonev

parent
fb4dad8272
commit
324fdcebcd
@ -116,7 +116,12 @@ export class ActionBar extends ActionBarBase {
|
||||
const viewController = (<UIViewController>page.ios);
|
||||
const navigationItem: UINavigationItem = viewController.navigationItem;
|
||||
const navController = <UINavigationController>viewController.navigationController;
|
||||
const navigationBar = navController ? navController.navigationBar : null;
|
||||
|
||||
if (!navController) {
|
||||
return;
|
||||
}
|
||||
|
||||
const navigationBar = navController.navigationBar;
|
||||
let previousController: UIViewController;
|
||||
|
||||
// Set Title
|
||||
@ -377,4 +382,4 @@ export class ActionBar extends ActionBarBase {
|
||||
this.updateFlatness(navBar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user