This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
android/app/src/main/java/com/microsoft/codepush/react Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,15 @@ public String getJSBundleFileInternal(String assetsBundleFileName) {
213
213
this .mAssetsBundleFileName = assetsBundleFileName ;
214
214
String binaryJsBundleUrl = CodePushConstants .ASSETS_BUNDLE_PREFIX + assetsBundleFileName ;
215
215
216
- String packageFilePath = mUpdateManager .getCurrentPackageBundlePath (this .mAssetsBundleFileName );
216
+ String packageFilePath = null ;
217
+ try {
218
+ packageFilePath = mUpdateManager .getCurrentPackageBundlePath (this .mAssetsBundleFileName );
219
+ } catch (CodePushMalformedDataException e ) {
220
+ // We need to recover the app in case 'codepush.json' is corrupted
221
+ CodePushUtils .log (e .getMessage ());
222
+ clearUpdates ();
223
+ }
224
+
217
225
if (packageFilePath == null ) {
218
226
// There has not been any downloaded updates.
219
227
CodePushUtils .logBundleUrl (binaryJsBundleUrl );
Original file line number Diff line number Diff line change @@ -349,6 +349,11 @@ protected Void doInBackground(Void... params) {
349
349
CodePushUtils .setJSONValueForKey (currentPackage , "isPending" , currentUpdateIsPending );
350
350
promise .resolve (CodePushUtils .convertJsonObjectToWritable (currentPackage ));
351
351
}
352
+ } catch (CodePushMalformedDataException e ) {
353
+ // We need to recover the app in case 'codepush.json' is corrupted
354
+ CodePushUtils .log (e .getMessage ());
355
+ clearUpdates ();
356
+ promise .resolve (null );
352
357
} catch (CodePushUnknownException e ) {
353
358
CodePushUtils .log (e );
354
359
promise .reject (e );
You can’t perform that action at this time.
0 commit comments