mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +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 {
|
} else {
|
||||||
// Get the path to the image. Makes loading so much easier.
|
// Get the path to the image. Makes loading so much easier.
|
||||||
String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
|
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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
Bitmap bitmap = getScaledBitmap(imagePath);
|
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) {
|
if (this.correctOrientation) {
|
||||||
String[] cols = { MediaStore.Images.Media.ORIENTATION };
|
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);
|
this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bitmap.recycle();
|
if (bitmap != null) {
|
||||||
bitmap = null;
|
bitmap.recycle();
|
||||||
|
bitmap = null;
|
||||||
|
}
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user