Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
- In some rare situations the BitmapFactory can throw a IllegalArgume…
Browse files Browse the repository at this point in the history
…ntException when ever the opts.inBitmap is not null and the native part of the decoder returns a null. My impression is that either there is a rare problem with the bitmap pool (wrong dimensions) or the image might have a different config (png vs gif for instance).

Signed-off-by: Carlos Sobrinho <[email protected]>
  • Loading branch information
Carlos Sobrinho committed Sep 3, 2013
1 parent 9b83f3e commit 0c8659e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/src/com/bumptech/glide/resize/load/Downsampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ private Bitmap decodeStream(RecyclableBufferedInputStream bis, BitmapFactory.Opt
//won't go past our pre-allocated 16kb
}

final Bitmap result = BitmapFactory.decodeStream(bis, null, options);

Bitmap result = null;
try {
result = BitmapFactory.decodeStream(bis, null, options);

if (options.inJustDecodeBounds) {
bis.reset();
bis.clearMark();
Expand All @@ -173,6 +175,8 @@ private Bitmap decodeStream(RecyclableBufferedInputStream bis, BitmapFactory.Opt
}
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
}

return result;
Expand Down

0 comments on commit 0c8659e

Please sign in to comment.