diff options
author | Yuli Huang <yuli@google.com> | 2011-09-28 01:21:15 +0800 |
---|---|---|
committer | Yuli Huang <yuli@google.com> | 2011-09-28 01:21:15 +0800 |
commit | a9c225508657af33060ff1fd950e8e3e954dea42 (patch) | |
tree | 175ed08157f5e72799c6c0cafd5dd34a6819f119 /src/com/android/gallery3d/photoeditor/BitmapUtils.java | |
parent | 1ef98e32ccc4c6f3f69f812c1a92294065d80271 (diff) | |
download | android_packages_apps_Snap-a9c225508657af33060ff1fd950e8e3e954dea42.tar.gz android_packages_apps_Snap-a9c225508657af33060ff1fd950e8e3e954dea42.tar.bz2 android_packages_apps_Snap-a9c225508657af33060ff1fd950e8e3e954dea42.zip |
Fix b/5287869 (and b/5369640).
Images from some app (MMS) may not have columns that PhotoEditor tries
to query, for example: the orientation. Just ignore the absent columns.
Change-Id: I1cda4e32241d9be7819453ede225388c7535c18c
Diffstat (limited to 'src/com/android/gallery3d/photoeditor/BitmapUtils.java')
-rw-r--r-- | src/com/android/gallery3d/photoeditor/BitmapUtils.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/photoeditor/BitmapUtils.java b/src/com/android/gallery3d/photoeditor/BitmapUtils.java index 5211a8379..ef01e4868 100644 --- a/src/com/android/gallery3d/photoeditor/BitmapUtils.java +++ b/src/com/android/gallery3d/photoeditor/BitmapUtils.java @@ -126,11 +126,14 @@ public class BitmapUtils { private int getOrientation(Uri uri) { int orientation = 0; - Cursor cursor = context.getContentResolver().query(uri, IMAGE_PROJECTION, null, null, null); + Cursor cursor = null; try { + cursor = context.getContentResolver().query(uri, IMAGE_PROJECTION, null, null, null); if ((cursor != null) && cursor.moveToNext()) { orientation = cursor.getInt(INDEX_ORIENTATION); } + } catch (Exception e) { + // Ignore error for no orientation column; just use the default orientation value 0. } finally { if (cursor != null) { cursor.close(); |