Skip to content
Snippets Groups Projects
Commit 63a0e3de authored by Aline Bonnet's avatar Aline Bonnet
Browse files

smartlist: fix crash when we delete a contact


When we delete a system contact by clicking on the photo in the
smartlist and then we restart the application, the smartlist does not
loaded because the contact is null.

Checks are added to fixes this problem.

Change-Id: Iff0ffbb6c6ef99e6051e14f288bc1bb709a2f1d5
Reviewed-by: default avatarHadrien De Sousa <hadrien.desousa@savoirfairelinux.com>
parent 16c268da
No related branches found
No related tags found
No related merge requests found
......@@ -219,7 +219,10 @@ public class ContactServiceImpl extends ContactService {
contentUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
}
Cursor result = contentResolver.query(contentUri, CONTACT_PROJECTION, null, null, null);
Cursor result = null;
if (contentUri != null) {
result = contentResolver.query(contentUri, CONTACT_PROJECTION, null, null, null);
}
if (result == null) {
return null;
......
......@@ -247,7 +247,9 @@ public abstract class ContactService extends Observable {
if (contact == null && (settings.isAllowSystemContacts() && mDeviceRuntimeService.hasContactPermission())) {
Log.w(TAG, "getContactById : cache miss for " + id);
contact = findContactByIdFromSystem(id, key);
mContactList.put(id, contact);
if (contact != null) {
mContactList.put(id, contact);
}
}
return contact;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment