Skip to content

Commit 2a051e4

Browse files
robertpaul01Max
authored andcommitted
Adding check for null ref before accessing array index (microsoft#1116)
* Adding check for null ref before accessing array index * Adding log for missing jsCodeLocation setting
1 parent 0657975 commit 2a051e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/postlink/ios/postlink.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ module.exports = () => {
3939
}
4040

4141
// 2. Modify jsCodeLocation value assignment
42-
var oldJsCodeLocationAssignmentStatement = appDelegateContents.match(/(jsCodeLocation = .*)/)[1];
42+
var jsCodeLocations = appDelegateContents.match(/(jsCodeLocation = .*)/);
43+
var oldJsCodeLocationAssignmentStatement;
44+
if (jsCodeLocations) {
45+
oldJsCodeLocationAssignmentStatement = jsCodeLocations[1];
46+
} else {
47+
console.log('Couldn\'t find jsCodeLocation setting in AppDelegate.');
48+
}
4349
var newJsCodeLocationAssignmentStatement = "jsCodeLocation = [CodePush bundleURL];";
4450
if (~appDelegateContents.indexOf(newJsCodeLocationAssignmentStatement)) {
4551
console.log(`"jsCodeLocation" already pointing to "[CodePush bundleURL]".`);

0 commit comments

Comments
 (0)