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) {
213213 this .mAssetsBundleFileName = assetsBundleFileName ;
214214 String binaryJsBundleUrl = CodePushConstants .ASSETS_BUNDLE_PREFIX + assetsBundleFileName ;
215215
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+
217225 if (packageFilePath == null ) {
218226 // There has not been any downloaded updates.
219227 CodePushUtils .logBundleUrl (binaryJsBundleUrl );
Original file line number Diff line number Diff line change @@ -349,6 +349,11 @@ protected Void doInBackground(Void... params) {
349349 CodePushUtils .setJSONValueForKey (currentPackage , "isPending" , currentUpdateIsPending );
350350 promise .resolve (CodePushUtils .convertJsonObjectToWritable (currentPackage ));
351351 }
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 );
352357 } catch (CodePushUnknownException e ) {
353358 CodePushUtils .log (e );
354359 promise .reject (e );
You can’t perform that action at this time.
0 commit comments