From 951d073ad6abdedc6ef2d086d179aad729b0169b Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 17 Dec 2025 14:28:34 -0500 Subject: [PATCH] Fix possible crash when splitting contacts with invalid e164s. --- .../thoughtcrime/securesms/database/RecipientTable.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 82e087f2e4..7a56a6c842 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/RecipientTable.kt @@ -2390,6 +2390,16 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da AppDependencies.databaseObserver.notifyRecipientChanged(id) } + if (record.e164 == null) { + Log.w(TAG, "[WithSplit] Missing e164! Not adding the PNI/E164 record.") + return + } + + if (!SignalE164Util.isPotentialE164(record.e164)) { + Log.w(TAG, "[WithSplit] Invalid e164! Not adding the PNI/E164 record.") + return + } + val splitId = getAndPossiblyMerge(null, record.pni, record.e164) Log.i(TAG, "Split off new recipient as $splitId (ACI-only recipient is $id)") }