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();
holder.name.setText(
(c.getFullName() != null)
(c != null && c.getFullName() != null)
? c.getFullName()
: (ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());

View file

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