summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2012-10-01 17:31:17 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-01 17:31:17 -0700
commit83f50a9b3f3ba9ada8dc6999ed997499fd78c052 (patch)
tree6b4849f9168c3eee368261b93195b447d3983991 /src
parent526c306051b0b92bcd54923a52a4c5bccaef7d77 (diff)
parent02506a90577ba3f767d192b9547d4478bcc149a8 (diff)
downloadandroid_packages_apps_Gallery2-83f50a9b3f3ba9ada8dc6999ed997499fd78c052.tar.gz
android_packages_apps_Gallery2-83f50a9b3f3ba9ada8dc6999ed997499fd78c052.tar.bz2
android_packages_apps_Gallery2-83f50a9b3f3ba9ada8dc6999ed997499fd78c052.zip
Merge "Fix for exceptions when image has no orientation data." into gb-ub-photos-arches
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
index 19a841a4b..2c8fff9a2 100644
--- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
+++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
+import com.android.gallery3d.common.Utils;
import com.android.gallery3d.filtershow.FilterShowActivity;
import com.android.gallery3d.filtershow.HistoryAdapter;
import com.android.gallery3d.filtershow.imageshow.ImageShow;
@@ -17,6 +18,7 @@ import com.android.gallery3d.R;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
@@ -58,11 +60,17 @@ public class ImageLoader {
}
private int getOrientation(Uri uri) {
- Cursor cursor = mContext.getContentResolver().query(uri,
- new String[] {
- MediaStore.Images.ImageColumns.ORIENTATION
- },
- null, null, null);
+ Cursor cursor = null;
+ try {
+ cursor = mContext.getContentResolver().query(uri,
+ new String[] {
+ MediaStore.Images.ImageColumns.ORIENTATION
+ },
+ null, null, null);
+ } catch (SQLiteException e){
+ Utils.closeSilently(cursor);
+ return ExifInterface.ORIENTATION_UNDEFINED;
+ }
if (cursor.getCount() != 1) {
return -1;