mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
CB-1293: Camera.getPicture crashes when selecting from a Picasa album on Android
This commit is contained in:
parent
5ad7a7c014
commit
a29340523f
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user