Merge change 20945
* changes: contrary to popular belief ContentResolver.query can return null. so check.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user