Improve conversion of Recipient to SignalServiceAddress.

This commit is contained in:
Greyson Parrelli
2021-08-24 09:56:26 -04:00
committed by Alex Hart
parent 1a21cafe6c
commit 5787a5f68a
26 changed files with 197 additions and 39 deletions

View File

@@ -268,7 +268,11 @@ public final class ProfileUtil {
private static @NonNull SignalServiceAddress toSignalServiceAddress(@NonNull Context context, @NonNull Recipient recipient) throws IOException {
if (recipient.getRegistered() == RecipientDatabase.RegisteredState.NOT_REGISTERED) {
return new SignalServiceAddress(recipient.getUuid().orNull(), recipient.getE164().orNull());
if (recipient.hasUuid()) {
return new SignalServiceAddress(recipient.requireUuid(), recipient.getE164().orNull());
} else {
throw new IOException(recipient.getId() + " not registered!");
}
} else {
return RecipientUtil.toSignalServiceAddress(context, recipient);
}