diff options
-rw-r--r-- | core/java/com/android/internal/widget/ContactHeaderWidget.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java index eac5d2d..58fa0ba 100644 --- a/core/java/com/android/internal/widget/ContactHeaderWidget.java +++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java @@ -270,7 +270,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList c = mContentResolver.query(Uri.withAppendedPath( RawContacts.CONTENT_FILTER_EMAIL_URI, Uri.encode(emailAddress)), EMAIL_LOOKUP_PROJECTION, null, null, null); - if (c.moveToFirst()) { + if (c != null && c.moveToFirst()) { long contactId = c.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX); bindFromContactId(contactId); } else { @@ -296,7 +296,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList try { c = mContentResolver.query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, number), PHONE_LOOKUP_PROJECTION, null, null, null); - if (c.moveToFirst()) { + if (c != null && c.moveToFirst()) { long contactId = c.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX); bindFromContactId(contactId); } else { @@ -408,7 +408,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList new String[] { Photo.PHOTO }, null, null, null); - if (photoCursor.moveToFirst() && !photoCursor.isNull(0)) { + if (photoCursor != null && photoCursor.moveToFirst() && !photoCursor.isNull(0)) { byte[] photoData = photoCursor.getBlob(0); photoBm = BitmapFactory.decodeByteArray(photoData, 0, photoData.length, options); |