diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt b/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt index 2363d04e6e..5b04c8a72b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt @@ -1220,7 +1220,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da val out: MutableMap = HashMap() readableDatabase - .select(ID, STORAGE_SERVICE_ID, TYPE) + .select(ID, STORAGE_SERVICE_ID, TYPE, ACI_COLUMN, PNI_COLUMN) .from(TABLE_NAME) .where( """ @@ -1251,7 +1251,15 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da val key = Base64.decodeOrThrow(encodedKey) when (recipientType) { - RecipientType.INDIVIDUAL -> out[id] = StorageId.forContact(key) + RecipientType.INDIVIDUAL -> { + val aci = ACI.parseOrNull(cursor.requireString(ACI_COLUMN)) + val pni = PNI.parseOrNull(cursor.requireString(PNI_COLUMN)) + if (aci == null && pni == null) { + Log.w(TAG, "All identifiers are null! Skipping. Before parsing, ACI: ${cursor.requireString(ACI_COLUMN) != null}, PNI: ${cursor.requireString(PNI_COLUMN) != null}") + } else { + out[id] = StorageId.forContact(key) + } + } RecipientType.GV1 -> out[id] = StorageId.forGroupV1(key) RecipientType.DISTRIBUTION_LIST -> out[id] = StorageId.forStoryDistributionList(key) RecipientType.CALL_LINK -> out[id] = StorageId.forCallLink(key)