Do not add in linphonecore friends with invalid sip address + fix crash in contacts list

This commit is contained in:
Sylvain Berfini 2016-03-23 11:05:01 +01:00 committed by Jehan Monnier
parent 43090dd342
commit 8e8a86941d
2 changed files with 7 additions and 1 deletions

View file

@ -551,11 +551,17 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
@Override
public int getPositionForSection(int sectionIndex) {
if (sectionIndex >= sections.length || sectionIndex < 0) {
return 0;
}
return map.get(sections[sectionIndex]);
}
@Override
public int getSectionForPosition(int position) {
if (position >= contacts.size() || position < 0) {
return 0;
}
LinphoneContact contact = contacts.get(position);
String letter = contact.getFullName().substring(0, 1);
return sectionsList.indexOf(letter);

View file

@ -409,7 +409,7 @@ public class LinphoneContact implements Serializable {
}
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
if (lc != null && friend.getAddress() != null) {
try {
lc.addFriend(friend);
} catch (LinphoneCoreException e) {