incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject android commit: CB-1293: Camera.getPicture crashes when selecting from a Picasa album on Android
Date Fri, 07 Sep 2012 20:29:47 GMT
Updated Branches:
  refs/heads/master 5ad7a7c01 -> a29340523


CB-1293: Camera.getPicture crashes when selecting from a Picasa album on Android


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/a2934052
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/a2934052
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/a2934052

Branch: refs/heads/master
Commit: a29340523fa9abf73cbab83676b397c27b7519d3
Parents: 5ad7a7c
Author: Simon MacDonald <simon.macdonald@gmail.com>
Authored: Fri Sep 7 15:20:31 2012 -0400
Committer: Simon MacDonald <simon.macdonald@gmail.com>
Committed: Fri Sep 7 15:20:31 2012 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CameraLauncher.java     |   17 +++++++++++---
 1 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/a2934052/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 0e79c5d..a72de6a 100755
--- a/framework/src/org/apache/cordova/CameraLauncher.java
+++ b/framework/src/org/apache/cordova/CameraLauncher.java
@@ -388,12 +388,19 @@ 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);
-                        // If we don't have a valid image path quit.
+                        Log.d(LOG_TAG, "Real path = " + imagePath);
+                        // If we don't have a valid image so quit.
                         if (imagePath == null) {
-                            this.failPicture("Unable to retreive picture!");
+                        	Log.d(LOG_TAG, "I either have a null image path or bitmap");
+                            this.failPicture("Unable to retreive path to picture!");
                             return;
                         }
                         Bitmap bitmap = getScaledBitmap(imagePath);
+                        if (bitmap == null) {
+                        	Log.d(LOG_TAG, "I either have a null image path or bitmap");
+                            this.failPicture("Unable to create bitmap!");
+                            return;
+                        }
 
                         if (this.correctOrientation) {
                             String[] cols = { MediaStore.Images.Media.ORIENTATION };
@@ -456,8 +463,10 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
                                 this.success(new PluginResult(PluginResult.Status.OK, uri.toString()),
this.callbackId);
                             }
                         }
-                        bitmap.recycle();
-                        bitmap = null;
+                        if (bitmap != null) {
+	                        bitmap.recycle();
+	                        bitmap = null;
+                        }
                         System.gc();
                     }
                 }


Mime
View raw message