Prevent crashes if contact is null

This commit is contained in:
Sylvain Berfini 2019-01-02 17:28:28 +01:00
parent fb88c5df48
commit e931733ebf
2 changed files with 9 additions and 6 deletions

View file

@ -60,7 +60,7 @@ class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoViewHolder> {
LinphoneContact c = ca.getContact(); LinphoneContact c = ca.getContact();
holder.name.setText( holder.name.setText(
(c.getFullName() != null) (c != null && c.getFullName() != null)
? c.getFullName() ? c.getFullName()
: (ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername()); : (ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());

View file

@ -78,11 +78,14 @@ public class ContactAddress implements Serializable {
} }
public Address getAddress() { public Address getAddress() {
String presence = String presence = null;
mContact.getContactFromPresenceModelForUriOrTel( if (mContact != null) {
(mPhoneNumber != null && !mPhoneNumber.isEmpty()) presence =
? mPhoneNumber mContact.getContactFromPresenceModelForUriOrTel(
: mAddress); (mPhoneNumber != null && !mPhoneNumber.isEmpty())
? mPhoneNumber
: mAddress);
}
Address addr = Factory.instance().createAddress(presence != null ? presence : mAddress); Address addr = Factory.instance().createAddress(presence != null ? presence : mAddress);
// Remove the user=phone URI param if existing, it will break everything otherwise // Remove the user=phone URI param if existing, it will break everything otherwise
if (addr.hasUriParam("user")) { if (addr.hasUriParam("user")) {