mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Guard against null pointer exception in ES File Explorer being used to get a picture using DATA_URL
This commit is contained in:
parent
979ae94698
commit
5d34aa0afe
@ -388,9 +388,12 @@ 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);
|
||||||
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 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");
|
Log.d(LOG_TAG, "I either have a null image path or bitmap");
|
||||||
this.failPicture("Unable to retrieve path to picture!");
|
this.failPicture("Unable to retrieve path to picture!");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user