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

pull/441/head
Jubb 4 years ago
parent 93f7d428cb
commit 8476e090e2

@ -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 {

Loading…
Cancel
Save