From c52dc10c9e49dcb21b6488c413aa55a5b365dca0 Mon Sep 17 00:00:00 2001 From: macdonst Date: Wed, 8 Aug 2012 15:53:48 -0400 Subject: [PATCH] CB-1212: When camera is started, and then cancelled with no photo, attempt to read exif data results in fatal error --- .../org/apache/cordova/CameraLauncher.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java index 6d05c647..e8202652 100755 --- a/framework/src/org/apache/cordova/CameraLauncher.java +++ b/framework/src/org/apache/cordova/CameraLauncher.java @@ -273,20 +273,21 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie // If CAMERA if (srcType == CAMERA) { - // Create an ExifHelper to save the exif data that is lost during compression - ExifHelper exif = new ExifHelper(); - try { - if (this.encodingType == JPEG) { - exif.createInFile(DirectoryManager.getTempDirectoryPath(this.cordova.getActivity()) + "/.Pic.jpg"); - exif.readExifData(); - rotate = exif.getOrientation(); - } - } catch (IOException e) { - e.printStackTrace(); - } // If image available if (resultCode == Activity.RESULT_OK) { try { + // Create an ExifHelper to save the exif data that is lost during compression + ExifHelper exif = new ExifHelper(); + try { + if (this.encodingType == JPEG) { + exif.createInFile(DirectoryManager.getTempDirectoryPath(this.cordova.getActivity()) + "/.Pic.jpg"); + exif.readExifData(); + rotate = exif.getOrientation(); + } + } catch (IOException e) { + e.printStackTrace(); + } + Bitmap bitmap = null; Uri uri = null;