From 6dfa882803d4294cd05df2d1d255a11f04446676 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 16 Feb 2021 10:31:26 +1100 Subject: [PATCH] minor refactoring --- .../sending_receiving/MessageSenderClosedGroup.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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())