Do the setName after the setAddress when creationg LinphoneFriend to prevent warning in logs + prevent crash if fullname is null
This commit is contained in:
parent
b36d9103aa
commit
c7b47c68a1
2 changed files with 10 additions and 6 deletions
|
@ -126,8 +126,10 @@ public class ContactsManager extends ContentObserver {
|
|||
search = search.toLowerCase(Locale.getDefault());
|
||||
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
||||
for (LinphoneContact contact : contacts) {
|
||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||
searchContacts.add(contact);
|
||||
if (contact.getFullName() != null) {
|
||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||
searchContacts.add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
return searchContacts;
|
||||
|
@ -137,8 +139,10 @@ public class ContactsManager extends ContentObserver {
|
|||
search = search.toLowerCase(Locale.getDefault());
|
||||
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
||||
for (LinphoneContact contact : sipContacts) {
|
||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||
searchContacts.add(contact);
|
||||
if (contact.getFullName() != null) {
|
||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||
searchContacts.add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
return searchContacts;
|
||||
|
|
|
@ -317,7 +317,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
if (lc == null) return;
|
||||
|
||||
friend.edit();
|
||||
friend.setName(fullName);
|
||||
//TODO: handle removal of all existing SIP addresses
|
||||
for (LinphoneNumberOrAddress address : addresses) {
|
||||
try {
|
||||
|
@ -331,6 +330,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
Log.e(e);
|
||||
}
|
||||
}
|
||||
friend.setName(fullName);
|
||||
friend.done();
|
||||
|
||||
if (friend.getAddress() != null) {
|
||||
|
@ -383,7 +383,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
// Disable subscribes for now
|
||||
friend.enableSubscribes(false);
|
||||
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
|
||||
friend.setName(fullName);
|
||||
if (hasSipAddress) {
|
||||
for (LinphoneNumberOrAddress noa : addresses) {
|
||||
if (noa.isSIPAddress()) {
|
||||
|
@ -398,6 +397,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
}
|
||||
}
|
||||
friend.setName(fullName);
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null && friend.getAddress() != null) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue