summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2014-01-30 12:21:01 -0800
committerJay Shrauner <shrauner@google.com>2014-03-01 20:14:48 +0000
commit1e090bfaee34b45e1127dc1549bae1d60ca75b66 (patch)
treeeef190baa05a0557491907d7e4839c688816b02b
parent49a9c120b0b6e3942bc950143f1e2970c8ff374a (diff)
downloadandroid_packages_apps_Contacts-1e090bfaee34b45e1127dc1549bae1d60ca75b66.tar.gz
android_packages_apps_Contacts-1e090bfaee34b45e1127dc1549bae1d60ca75b66.tar.bz2
android_packages_apps_Contacts-1e090bfaee34b45e1127dc1549bae1d60ca75b66.zip
Fix NPE on non decodable Bitmap
Fix so don't crash if unable to decode Bitmap that user is attempting to assign to a contact. Bug:12819739 Change-Id: I34f31b1e84a76a15d4de92ccd5544ff502743079 (cherry picked from commit 5d170911503c81aca63a9a089aeb0c5664ef0487)
-rw-r--r--src/com/android/contacts/activities/AttachPhotoActivity.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/contacts/activities/AttachPhotoActivity.java b/src/com/android/contacts/activities/AttachPhotoActivity.java
index 2d9e9f578..e25bef2a4 100644
--- a/src/com/android/contacts/activities/AttachPhotoActivity.java
+++ b/src/com/android/contacts/activities/AttachPhotoActivity.java
@@ -223,6 +223,10 @@ public class AttachPhotoActivity extends ContactsActivity {
Log.w(TAG, "Could not find bitmap");
return;
}
+ if (bitmap == null) {
+ Log.w(TAG, "Could not decode bitmap");
+ return;
+ }
final Bitmap scaled = Bitmap.createScaledBitmap(bitmap, size, size, false);
final byte[] compressed = ContactPhotoUtils.compressBitmap(scaled);