You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/10/16 20:58:22 UTC

android commit: CB-4471: Mitigating Android 4.3 errors where data isn't being passed so NPE doesn't happen

Updated Branches:
  refs/heads/2.9.x cb11486f6 -> cdb49eaa1


CB-4471: Mitigating Android 4.3 errors where data isn't being passed so NPE doesn't happen


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

Branch: refs/heads/2.9.x
Commit: cdb49eaa1fda8a9ee262035cf6d162baa4f95828
Parents: cb11486
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Oct 16 11:58:07 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Oct 16 11:58:07 2013 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Capture.java | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/cdb49eaa/framework/src/org/apache/cordova/Capture.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java
index e6e9ece..85e0743 100644
--- a/framework/src/org/apache/cordova/Capture.java
+++ b/framework/src/org/apache/cordova/Capture.java
@@ -305,14 +305,20 @@ public class Capture extends CordovaPlugin {
                 // Get the uri of the video clip
                 Uri data = intent.getData();
                 // create a file object from the uri
-                results.put(createMediaFile(data));
-
-                if (results.length() >= limit) {
-                    // Send Uri back to JavaScript for viewing video
-                    this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
-                } else {
-                    // still need to capture more video clips
-                    captureVideo(duration);
+                if(data == null)
+                {
+                    this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
+                }
+                else
+                {
+                    results.put(createMediaFile(data));
+                    if (results.length() >= limit) {
+                        // Send Uri back to JavaScript for viewing video
+                        this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
+                    } else {
+                        // still need to capture more video clips
+                        captureVideo(duration);
+                    }
                 }
             }
         }