From 9265229d2e81ee96b4cdafa6a316d072b841e928 Mon Sep 17 00:00:00 2001 From: Michelle Tang Date: Wed, 26 Aug 2026 14:37:44 -0400 Subject: [PATCH] Fix chat folder crash on missing GV2 key. --- .../securesms/storage/StorageSyncModels.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/storage/StorageSyncModels.kt b/app/src/main/java/org/thoughtcrime/securesms/storage/StorageSyncModels.kt index 2ae7dd5aca..8b7ef12bba 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/storage/StorageSyncModels.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/storage/StorageSyncModels.kt @@ -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 }