mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-20 08:45:50 +01:00
Fix chat folder crash on missing GV2 key.
This commit is contained in:
@@ -507,7 +507,7 @@ object StorageSyncModels {
|
||||
return recipientIds.mapNotNull { id ->
|
||||
val recipient = SignalDatabase.recipients.getRecordForSync(id)
|
||||
if (recipient == null) {
|
||||
Log.w(TAG, "Recipient $id from notification profile cannot be found")
|
||||
Log.w(TAG, "Recipient $id cannot be found")
|
||||
null
|
||||
} else {
|
||||
when (recipient.recipientType) {
|
||||
@@ -521,10 +521,22 @@ object StorageSyncModels {
|
||||
)
|
||||
}
|
||||
RecipientType.GV1 -> {
|
||||
RemoteRecipient(legacyGroupId = recipient.groupId!!.requireV1().decodedId.toByteString())
|
||||
val groupId = recipient.groupId
|
||||
if (groupId == null || !groupId.isV1) {
|
||||
Log.w(TAG, "Recipient $id is a GV1 recipient without a V1 group id. Skipping.")
|
||||
null
|
||||
} else {
|
||||
RemoteRecipient(legacyGroupId = groupId.requireV1().decodedId.toByteString())
|
||||
}
|
||||
}
|
||||
RecipientType.GV2 -> {
|
||||
RemoteRecipient(groupMasterKey = recipient.syncExtras.groupMasterKey!!.serialize().toByteString())
|
||||
val masterKey = recipient.syncExtras.groupMasterKey
|
||||
if (masterKey == null) {
|
||||
Log.w(TAG, "Recipient $id is a GV2 recipient without a master key. Skipping.")
|
||||
null
|
||||
} else {
|
||||
RemoteRecipient(groupMasterKey = masterKey.serialize().toByteString())
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user