Fixed crash when contact doesn't have a name
This commit is contained in:
parent
2bb0e3bdbb
commit
a3ad1105e2
2 changed files with 20 additions and 12 deletions
|
@ -431,7 +431,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
||||||
String prevLetter = null;
|
String prevLetter = null;
|
||||||
for (int i = 0; i < contacts.size(); i++) {
|
for (int i = 0; i < contacts.size(); i++) {
|
||||||
LinphoneContact contact = contacts.get(i);
|
LinphoneContact contact = contacts.get(i);
|
||||||
String firstLetter = contact.getFullName().substring(0, 1).toUpperCase(Locale.getDefault());
|
String fullName = contact.getFullName();
|
||||||
|
if (fullName == null || fullName.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||||
if (!firstLetter.equals(prevLetter)) {
|
if (!firstLetter.equals(prevLetter)) {
|
||||||
prevLetter = firstLetter;
|
prevLetter = firstLetter;
|
||||||
map.put(firstLetter, i);
|
map.put(firstLetter, i);
|
||||||
|
@ -561,7 +565,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LinphoneContact contact = contacts.get(position);
|
LinphoneContact contact = contacts.get(position);
|
||||||
String letter = contact.getFullName().substring(0, 1);
|
String fullName = contact.getFullName();
|
||||||
|
if (fullName == null || fullName.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
String letter = fullName.substring(0, 1);
|
||||||
return sectionsList.indexOf(letter);
|
return sectionsList.indexOf(letter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,16 +368,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
addresses = new ArrayList<LinphoneNumberOrAddress>();
|
addresses = new ArrayList<LinphoneNumberOrAddress>();
|
||||||
hasSipAddress = false;
|
hasSipAddress = false;
|
||||||
|
|
||||||
if (!isAndroidContact() && isLinphoneFriend()) {
|
if (isAndroidContact()) {
|
||||||
fullName = friend.getName();
|
|
||||||
thumbnailUri = null;
|
|
||||||
photoUri = null;
|
|
||||||
LinphoneAddress addr = friend.getAddress();
|
|
||||||
if (addr != null) {
|
|
||||||
addresses.add(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
|
||||||
hasSipAddress = true;
|
|
||||||
}
|
|
||||||
} else if (isAndroidContact()) {
|
|
||||||
String id = getAndroidId();
|
String id = getAndroidId();
|
||||||
getContactNames(id);
|
getContactNames(id);
|
||||||
setThumbnailUri(getContactPictureUri(id));
|
setThumbnailUri(getContactPictureUri(id));
|
||||||
|
@ -416,6 +407,15 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (isLinphoneFriend()) {
|
||||||
|
fullName = friend.getName();
|
||||||
|
thumbnailUri = null;
|
||||||
|
photoUri = null;
|
||||||
|
LinphoneAddress addr = friend.getAddress();
|
||||||
|
if (addr != null) {
|
||||||
|
addresses.add(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
||||||
|
hasSipAddress = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue