summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Storage.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/Storage.java')
-rw-r--r--src/com/android/camera/Storage.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java
index 00bd8d1c4..49435e4c0 100644
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -82,6 +82,12 @@ public class Storage {
public static Uri addImage(ContentResolver resolver, String title,
long date, Location location, int orientation, ExifInterface exif,
byte[] jpeg, int width, int height, String pictureFormat) {
+ int jpegLength = 0;
+
+ if (jpeg != null) {
+ jpegLength = jpeg.length;
+ }
+
// Save the image.
String path = generateFilepath(title, pictureFormat);
if (exif != null && (pictureFormat == null ||
@@ -91,7 +97,7 @@ public class Storage {
} catch (Exception e) {
Log.e(TAG, "Failed to write data", e);
}
- } else {
+ } else if (jpeg != null) {
if (!(pictureFormat.equalsIgnoreCase("jpeg") || pictureFormat == null)) {
File dir = new File(RAW_DIRECTORY);
dir.mkdirs();
@@ -99,7 +105,7 @@ public class Storage {
writeFile(path, jpeg);
}
return addImage(resolver, title, date, location, orientation,
- jpeg.length, path, width, height, pictureFormat);
+ jpegLength, path, width, height, pictureFormat);
}
// Add the image to media store.