Skip to content

Commit 8d97fdd

Browse files
authored
Merge pull request #4 from Soomgo-Mobile/bugfix/issue-1
refactor: explicitly handle errors in the updateChecker function
2 parents eadf826 + 6e8785d commit 8d97fdd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CodePush.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,19 @@ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchC
9090
log(`An error has occurred at update checker : ${error.stack}`);
9191
if (sharedCodePushOptions.fallbackToAppCenter) {
9292
return await sdk.queryUpdateWithCurrentPackage(queryPackage);
93+
} else {
94+
// update will not happen
95+
return undefined;
9396
}
9497
}
9598
})()
9699
: await sdk.queryUpdateWithCurrentPackage(queryPackage);
97100

98-
const fileName = update && typeof update.downloadUrl === 'string' ? update.downloadUrl.split('/').pop() : null;
99-
if (sharedCodePushOptions.bundleHost && fileName) {
100-
update.downloadUrl = sharedCodePushOptions.bundleHost + fileName;
101+
if (sharedCodePushOptions.bundleHost && update) {
102+
const fileName = typeof update.downloadUrl === 'string' ? update.downloadUrl.split('/').pop() : null;
103+
if (fileName) {
104+
update.downloadUrl = sharedCodePushOptions.bundleHost + fileName;
105+
}
101106
}
102107

103108
/*

0 commit comments

Comments
 (0)