Fixed crash in contacts fetching
This commit is contained in:
parent
9dab31ee54
commit
2fb953e80e
1 changed files with 20 additions and 0 deletions
|
@ -553,6 +553,11 @@ public class LinphoneContact extends AndroidContact
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE.equals(mime)) {
|
if (ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE.equals(mime)) {
|
||||||
|
if (data1 == null && data4 == null) {
|
||||||
|
Log.e("[Linphone Contact] Phone number data are both null !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.d("[Linphone Contact] Found phone number " + data1 + " (" + data4 + ")");
|
Log.d("[Linphone Contact] Found phone number " + data1 + " (" + data4 + ")");
|
||||||
addNumberOrAddress(new LinphoneNumberOrAddress(data1, data4));
|
addNumberOrAddress(new LinphoneNumberOrAddress(data1, data4));
|
||||||
} else if (ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE.equals(mime)
|
} else if (ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE.equals(mime)
|
||||||
|
@ -560,12 +565,27 @@ public class LinphoneContact extends AndroidContact
|
||||||
.getApplicationContext()
|
.getApplicationContext()
|
||||||
.getString(R.string.linphone_address_mime_type)
|
.getString(R.string.linphone_address_mime_type)
|
||||||
.equals(mime)) {
|
.equals(mime)) {
|
||||||
|
if (data1 == null) {
|
||||||
|
Log.e("[Linphone Contact] SIP address is null !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.d("[Linphone Contact] Found SIP address " + data1);
|
Log.d("[Linphone Contact] Found SIP address " + data1);
|
||||||
addNumberOrAddress(new LinphoneNumberOrAddress(data1, true));
|
addNumberOrAddress(new LinphoneNumberOrAddress(data1, true));
|
||||||
} else if (ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE.equals(mime)) {
|
} else if (ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE.equals(mime)) {
|
||||||
|
if (data1 == null) {
|
||||||
|
Log.e("[Linphone Contact] Organization is null !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.d("[Linphone Contact] Found organization " + data1);
|
Log.d("[Linphone Contact] Found organization " + data1);
|
||||||
setOrganization(data1, false);
|
setOrganization(data1, false);
|
||||||
} else if (ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE.equals(mime)) {
|
} else if (ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE.equals(mime)) {
|
||||||
|
if (data2 == null && data3 == null) {
|
||||||
|
Log.e("[Linphone Contact] Firstname and lastname are both null !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.d("[Linphone Contact] Found first name " + data2 + " and last name " + data3);
|
Log.d("[Linphone Contact] Found first name " + data2 + " and last name " + data3);
|
||||||
setFirstNameAndLastName(data2, data3, false);
|
setFirstNameAndLastName(data2, data3, false);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue