Fix potential NPE during group send.
This commit is contained in:
parent
c725a2fabb
commit
db4634a0dd
2 changed files with 9 additions and 2 deletions
|
@ -2115,9 +2115,11 @@ public class SignalServiceMessageSender {
|
|||
|
||||
for (int i = 0; i < RETRY_COUNT; i++) {
|
||||
GroupTargetInfo targetInfo = buildGroupTargetInfo(recipients);
|
||||
final GroupTargetInfo targetInfoSnapshot = targetInfo;
|
||||
|
||||
Set<SignalProtocolAddress> sharedWith = aciStore.getSenderKeySharedWith(distributionId);
|
||||
List<SignalServiceAddress> needsSenderKey = targetInfo.destinations.stream()
|
||||
.filter(a -> !sharedWith.contains(a))
|
||||
.filter(a -> !sharedWith.contains(a) || targetInfoSnapshot.sessions.get(a) == null)
|
||||
.map(a -> ServiceId.parseOrThrow(a.getName()))
|
||||
.distinct()
|
||||
.map(SignalServiceAddress::new)
|
||||
|
|
|
@ -56,6 +56,11 @@ public class SignalSealedSessionCipher {
|
|||
{
|
||||
try (SignalSessionLock.Lock unused = lock.acquire()) {
|
||||
List<SessionRecord> recipientSessions = recipients.stream().map(sessionMap::get).collect(Collectors.toList());
|
||||
|
||||
if (recipientSessions.contains(null)) {
|
||||
throw new NoSessionException("No session for some recipients");
|
||||
}
|
||||
|
||||
return cipher.multiRecipientEncrypt(recipients, recipientSessions, content);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue