Skip to content

Commit 324fdce

Browse files
DickSmithtsonevn
authored andcommitted
fix(action-bar): NativeScript#5743 navController may be null (NativeScript#6029)
* fix(action-bar): NativeScript#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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy