Skip to content

Commit

Permalink
Don't pool bitmaps with null configs
Browse files Browse the repository at this point in the history
They will cause an IllegalArgumentException in
some cases if passed in to decodeStream as 
inBitmap.
  • Loading branch information
Sam Judd committed Sep 5, 2013
1 parent 77e5613 commit c256841
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public LruBitmapPool(int maxSize) {

@Override
public synchronized boolean put(Bitmap bitmap) {
//BitmapFactory.decodeStream can sometimes return bitmaps with null configs, which can't generally be
//reused
if (bitmap.getConfig() == null) {
return false;
}

final int size = getSize(bitmap);

pool.put(bitmap);
Expand Down

0 comments on commit c256841

Please sign in to comment.