1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-12 04:25:08 -05:00

Avoid NullPointerException when decoding contact pictures

This commit is contained in:
cketti 2013-03-19 02:59:05 +01:00
parent 1c75590e7a
commit 9118097dcb

View File

@ -238,10 +238,12 @@ public class ContactPictureLoader {
if (stream != null) {
try {
Bitmap tempBitmap = BitmapFactory.decodeStream(stream);
bitmap = Bitmap.createScaledBitmap(tempBitmap, mPictureSizeInPx,
mPictureSizeInPx, true);
if (tempBitmap != bitmap) {
tempBitmap.recycle();
if (tempBitmap != null) {
bitmap = Bitmap.createScaledBitmap(tempBitmap, mPictureSizeInPx,
mPictureSizeInPx, true);
if (tempBitmap != bitmap) {
tempBitmap.recycle();
}
}
} finally {
try { stream.close(); } catch (IOException e) { /* ignore */ }