diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageSenderClosedGroup.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageSenderClosedGroup.kt index 8a1eae09a2..5716bc4933 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageSenderClosedGroup.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageSenderClosedGroup.kt @@ -275,11 +275,8 @@ fun MessageSender.sendLatestEncryptionKeyPair(publicKey: String, groupPublicKey: return } // Get the latest encryption key pair - val encryptionKeyPair = if (pendingKeyPair[groupPublicKey] != null && pendingKeyPair[groupPublicKey]!!.isPresent) { - pendingKeyPair[groupPublicKey]!!.get() - } else { - storage.getLatestClosedGroupEncryptionKeyPair(groupPublicKey) - } ?: return + val encryptionKeyPair = pendingKeyPair[groupPublicKey]?.orNull() + ?: storage.getLatestClosedGroupEncryptionKeyPair(groupPublicKey) ?: return // Send it val proto = SignalServiceProtos.KeyPair.newBuilder() proto.publicKey = ByteString.copyFrom(encryptionKeyPair.publicKey.serialize())