incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject android commit: Guard against null pointer exception in ES File Explorer being used to get a picture using DATA_URL
Date Wed, 03 Oct 2012 15:32:10 GMT
Updated Branches:
  refs/heads/master 979ae9469 -> 5d34aa0af


Guard against null pointer exception in ES File Explorer being used to get a picture using
DATA_URL


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

Branch: refs/heads/master
Commit: 5d34aa0afefad62e604fb1717be8860ff3579b2c
Parents: 979ae94
Author: Simon MacDonald <simon.macdonald@gmail.com>
Authored: Wed Oct 3 11:31:58 2012 -0400
Committer: Simon MacDonald <simon.macdonald@gmail.com>
Committed: Wed Oct 3 11:31:58 2012 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CameraLauncher.java     |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/5d34aa0a/framework/src/org/apache/cordova/CameraLauncher.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java
index 211cb42..efb14fc 100755
--- a/framework/src/org/apache/cordova/CameraLauncher.java
+++ b/framework/src/org/apache/cordova/CameraLauncher.java
@@ -388,9 +388,12 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
                     } else {
                         // Get the path to the image. Makes loading so much easier.
                         String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
-                        Log.d(LOG_TAG, "Real path = " + imagePath);
+                        String mimeType = FileUtils.getMimeType(imagePath);
+                        // Log.d(LOG_TAG, "Real path = " + imagePath);
+                        // Log.d(LOG_TAG, "mime type = " + mimeType);
                         // If we don't have a valid image so quit.
-                        if (imagePath == null) {
+                        if (imagePath == null || mimeType == null || 
+                                !(mimeType.equalsIgnoreCase("image/jpeg") || mimeType.equalsIgnoreCase("image/png")))
{
                         	Log.d(LOG_TAG, "I either have a null image path or bitmap");
                             this.failPicture("Unable to retrieve path to picture!");
                             return;


Mime
View raw message