OSDN Git Service

am 978f4aae: Fix for crash upon saving image
authornicolasroard <nicolasroard@google.com>
Thu, 14 Mar 2013 16:16:48 +0000 (09:16 -0700)
committerThe Android Automerger <android-build@android.com>
Thu, 14 Mar 2013 22:13:47 +0000 (15:13 -0700)
* commit '978f4aae1d2923fd125f85a6d5c568a26c571522':
  Fix for crash upon saving image

gallerycommon/src/com/android/gallery3d/exif/ExifOutputStream.java
gallerycommon/src/com/android/gallery3d/exif/ExifTag.java

index 6ea6554..e5a5bf0 100644 (file)
@@ -404,7 +404,7 @@ class ExifOutputStream extends FilterOutputStream {
             ifd1.removeTag(ExifInterface.getTrueTagKey(ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT));
             ifd1.removeTag(ExifInterface
                     .getTrueTagKey(ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH));
-        } else {
+        } else if (ifd1 != null) {
             // Get rid of offset and length tags if there is no thumbnail.
             ifd1.removeTag(ExifInterface.getTrueTagKey(ExifInterface.TAG_STRIP_OFFSETS));
             ifd1.removeTag(ExifInterface.getTrueTagKey(ExifInterface.TAG_STRIP_BYTE_COUNTS));
index 0b31c4d..24e7f53 100644 (file)
@@ -248,7 +248,9 @@ public class ExifTag {
         }
 
         long[] data = new long[value.length];
-        System.arraycopy(value, 0, data, 0, value.length);
+        for (int i = 0; i < value.length; i++) {
+            data[i] = value[i];
+        }
         mValue = data;
         mComponentCountActual = value.length;
         return true;