cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [12/32] android commit: CB-3523: Fix NPE on app restart with outstanding callback
Date Tue, 11 Jun 2013 00:15:27 GMT
CB-3523: Fix NPE on app restart with outstanding callback


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/403297d9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/403297d9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/403297d9

Branch: refs/heads/3.0.0
Commit: 403297d96795882de5f8103e51fbd2c38e758846
Parents: abba254
Author: Ian Clelland <iclelland@chromium.org>
Authored: Tue May 28 15:11:25 2013 -0400
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Tue May 28 15:11:25 2013 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaActivity.java    | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/403297d9/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 6e3d99d..4042b6b 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -856,18 +856,13 @@ public class CordovaActivity extends Activity implements CordovaInterface
{
             mUploadMessage = null;
         }
         CordovaPlugin callback = this.activityResultCallback;
-        if(callback == null)
-        {
-            if(initCallbackClass != null)
-            {
-                this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass);
-                callback = activityResultCallback;
-                LOG.d(TAG, "We have a callback to send this result to");
-                callback.onActivityResult(requestCode, resultCode, intent);
-            }
+        if(callback == null && initCallbackClass != null) {
+            // The application was restarted, but had defined an initial callback
+            // before being shut down.
+            this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass);
+            callback = this.activityResultCallback;
         }
-        else
-        {
+        if(callback != null) {
             LOG.d(TAG, "We have a callback to send this result to");
             callback.onActivityResult(requestCode, resultCode, intent);
         }


Mime
View raw message