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,10 +126,12 @@ public class ContactsManager extends ContentObserver {
|
||||||
search = search.toLowerCase(Locale.getDefault());
|
search = search.toLowerCase(Locale.getDefault());
|
||||||
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
||||||
for (LinphoneContact contact : contacts) {
|
for (LinphoneContact contact : contacts) {
|
||||||
|
if (contact.getFullName() != null) {
|
||||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||||
searchContacts.add(contact);
|
searchContacts.add(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return searchContacts;
|
return searchContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +139,12 @@ public class ContactsManager extends ContentObserver {
|
||||||
search = search.toLowerCase(Locale.getDefault());
|
search = search.toLowerCase(Locale.getDefault());
|
||||||
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
List<LinphoneContact> searchContacts = new ArrayList<LinphoneContact>();
|
||||||
for (LinphoneContact contact : sipContacts) {
|
for (LinphoneContact contact : sipContacts) {
|
||||||
|
if (contact.getFullName() != null) {
|
||||||
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
if (contact.getFullName().toLowerCase(Locale.getDefault()).contains(search)) {
|
||||||
searchContacts.add(contact);
|
searchContacts.add(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return searchContacts;
|
return searchContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
friend.edit();
|
friend.edit();
|
||||||
friend.setName(fullName);
|
|
||||||
//TODO: handle removal of all existing SIP addresses
|
//TODO: handle removal of all existing SIP addresses
|
||||||
for (LinphoneNumberOrAddress address : addresses) {
|
for (LinphoneNumberOrAddress address : addresses) {
|
||||||
try {
|
try {
|
||||||
|
@ -331,6 +330,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
friend.setName(fullName);
|
||||||
friend.done();
|
friend.done();
|
||||||
|
|
||||||
if (friend.getAddress() != null) {
|
if (friend.getAddress() != null) {
|
||||||
|
@ -383,7 +383,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
// Disable subscribes for now
|
// Disable subscribes for now
|
||||||
friend.enableSubscribes(false);
|
friend.enableSubscribes(false);
|
||||||
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
|
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
|
||||||
friend.setName(fullName);
|
|
||||||
if (hasSipAddress) {
|
if (hasSipAddress) {
|
||||||
for (LinphoneNumberOrAddress noa : addresses) {
|
for (LinphoneNumberOrAddress noa : addresses) {
|
||||||
if (noa.isSIPAddress()) {
|
if (noa.isSIPAddress()) {
|
||||||
|
@ -398,6 +397,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
friend.setName(fullName);
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null && friend.getAddress() != null) {
|
if (lc != null && friend.getAddress() != null) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue