fix: handle pendingKeyPair.getOrElse nullable after checking if key exists

This commit is contained in:
Jubb 2021-02-15 12:08:08 +11:00
parent 93f7d428cb
commit 8476e090e2

View File

@ -548,9 +548,8 @@ object ClosedGroupsProtocolV2 {
}
if (userPublicKey in admins) {
// send current encryption key to the latest added members
val encryptionKeyPair = pendingKeyPair.getOrElse(groupPublicKey) {
Optional.fromNullable(apiDB.getLatestClosedGroupEncryptionKeyPair(groupPublicKey))
}.orNull()
val encryptionKeyPair = pendingKeyPair[groupPublicKey]?.orNull()
?: apiDB.getLatestClosedGroupEncryptionKeyPair(groupPublicKey)
if (encryptionKeyPair == null) {
Log.d("Loki", "Couldn't get encryption key pair for closed group.")
} else {