FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(action-bar): #5743 navController may be null (#6029) · NativeScript/NativeScript@324fdce · GitHub

Commit 324fdce

Browse files
authored andcommitted
fix(action-bar): #5743 navController may be null (#6029)
* 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: https://github.com/NativeScript/NativeScript/blob/2fc1d8a8d4cf64e98eb98296e21564ac9b508f95/tns-core-modules/ui/action-bar/action-bar.ios.ts#L132 further up `navController` is checked for truthiness: https://github.com/NativeScript/NativeScript/blob/2fc1d8a8d4cf64e98eb98296e21564ac9b508f95/tns-core-modules/ui/action-bar/action-bar.ios.ts#L119 So applying same logic. * Adjusted per request
1 parent fb4dad8 commit 324fdce

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎tns-core-modules/ui/action-bar/action-bar.ios.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ export class ActionBar extends ActionBarBase {
116116
const viewController = (<UIViewController>page.ios);
117117
const navigationItem: UINavigationItem = viewController.navigationItem;
118118
const navController = <UINavigationController>viewController.navigationController;
119-
const navigationBar = navController ? navController.navigationBar : null;
119+
120+
if (!navController) {
121+
return;
122+
}
123+
124+
const navigationBar = navController.navigationBar;
120125
let previousController: UIViewController;
121126

122127
// Set Title
@@ -377,4 +382,4 @@ export class ActionBar extends ActionBarBase {
377382
this.updateFlatness(navBar);
378383
}
379384
}
380-
}
385+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL