|
34 | 34 |
|
35 | 35 | public class CodePushNativeModule extends ReactContextBaseJavaModule {
|
36 | 36 | private String mBinaryContentsHash = null;
|
37 |
| - private String mClientUniqueId = null; |
| 37 | + private String mClientUniqueId = null; |
38 | 38 | private LifecycleEventListener mLifecycleEventListener = null;
|
39 | 39 | private int mMinimumBackgroundDuration = 0;
|
40 | 40 |
|
@@ -105,7 +105,7 @@ private void loadBundle() {
|
105 | 105 | if (instanceManager == null) {
|
106 | 106 | return;
|
107 | 107 | }
|
108 |
| - |
| 108 | + |
109 | 109 | String latestJSBundleFile = mCodePush.getJSBundleFileInternal(mCodePush.getAssetsBundleFileName());
|
110 | 110 |
|
111 | 111 | // #2) Update the locally stored JS bundle file path
|
@@ -146,7 +146,7 @@ public void run() {
|
146 | 146 | loadBundleLegacy();
|
147 | 147 | }
|
148 | 148 | }
|
149 |
| - |
| 149 | + |
150 | 150 | private ReactInstanceManager resolveInstanceManager() throws NoSuchFieldException, IllegalAccessException {
|
151 | 151 | ReactInstanceManager instanceManager = CodePush.getReactInstanceManager();
|
152 | 152 | if (instanceManager != null) {
|
@@ -304,7 +304,14 @@ protected Void doInBackground(Void... params) {
|
304 | 304 | } else if (updateState == CodePushUpdateState.RUNNING.getValue() && currentUpdateIsPending) {
|
305 | 305 | // The caller wants the running update, but the current
|
306 | 306 | // one is pending, so we need to grab the previous.
|
307 |
| - promise.resolve(CodePushUtils.convertJsonObjectToWritable(mUpdateManager.getPreviousPackage())); |
| 307 | + JSONObject previousPackage = mUpdateManager.getPreviousPackage(); |
| 308 | + |
| 309 | + if (previousPackage == null) { |
| 310 | + promise.resolve(""); |
| 311 | + return null; |
| 312 | + } |
| 313 | + |
| 314 | + promise.resolve(CodePushUtils.convertJsonObjectToWritable(previousPackage)); |
308 | 315 | } else {
|
309 | 316 | // The current package satisfies the request:
|
310 | 317 | // 1) Caller wanted a pending, and there is a pending update
|
|
0 commit comments