From 9118097dcbdc396ef3b99c6a055fade5a2e25896 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 19 Mar 2013 02:59:05 +0100 Subject: [PATCH] Avoid NullPointerException when decoding contact pictures --- .../fsck/k9/activity/misc/ContactPictureLoader.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/activity/misc/ContactPictureLoader.java b/src/com/fsck/k9/activity/misc/ContactPictureLoader.java index 9b4d5f5c4..8479738bf 100644 --- a/src/com/fsck/k9/activity/misc/ContactPictureLoader.java +++ b/src/com/fsck/k9/activity/misc/ContactPictureLoader.java @@ -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 */ }