diff options
Diffstat (limited to 'photoviewer')
-rw-r--r-- | photoviewer/src/com/android/ex/photo/util/ImageUtils.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/photoviewer/src/com/android/ex/photo/util/ImageUtils.java b/photoviewer/src/com/android/ex/photo/util/ImageUtils.java index a932c8b..f37a1ad 100644 --- a/photoviewer/src/com/android/ex/photo/util/ImageUtils.java +++ b/photoviewer/src/com/android/ex/photo/util/ImageUtils.java @@ -100,6 +100,9 @@ public class ImageUtils { final BitmapFactory.Options opts = new BitmapFactory.Options(); final Point bounds = getImageBounds(resolver, uri); inputStream = openInputStream(resolver, uri); + if (bounds == null || inputStream == null) { + return null; + } opts.inSampleSize = Math.max(bounds.x / maxSize, bounds.y / maxSize); final Bitmap decodedBitmap = decodeStream(inputStream, null, opts); @@ -212,6 +215,9 @@ public class ImageUtils { try { opts.inJustDecodeBounds = true; inputStream = openInputStream(resolver, uri); + if (inputStream == null) { + return null; + } decodeStream(inputStream, null, opts); return new Point(opts.outWidth, opts.outHeight); |