mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 04:28:35 +00:00
Prevent crash when adding group member by username.
This commit is contained in:
@@ -667,7 +667,7 @@ public final class ContactSelectionListFragment extends LoggingFragment
|
||||
SelectedContact selectedContact = contact.isUsernameType() ? SelectedContact.forUsername(contact.getRecipientId().orElse(null), contact.getNumber())
|
||||
: SelectedContact.forPhone(contact.getRecipientId().orElse(null), contact.getNumber());
|
||||
|
||||
if (!canSelectSelf && Recipient.self().getId().equals(selectedContact.getOrCreateRecipientId(requireContext()))) {
|
||||
if (!canSelectSelf && !selectedContact.hasUsername() && Recipient.self().getId().equals(selectedContact.getOrCreateRecipientId(requireContext()))) {
|
||||
Toast.makeText(requireContext(), R.string.ContactSelectionListFragment_you_do_not_need_to_add_yourself_to_the_group, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ public final class SelectedContact {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasUsername() {
|
||||
return username != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when non-null recipient ids match, and false if not.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user