From cb4303ac23578f36f698f07592a3d04f5aa7d9a1 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 3 Aug 2017 09:32:56 -0700 Subject: [PATCH] Handle migration case where recipient_ids is completely empty No idea how a DB is in that state, but apparently it's possible Fixes #6850 // FREEBIE --- .../thoughtcrime/securesms/database/DatabaseFactory.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java index e42fb2f2c9..7acd5e5303 100644 --- a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java +++ b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java @@ -922,10 +922,10 @@ public class DatabaseFactory { if (resolved != null && resolved.moveToFirst()) { String address = resolved.getString(0); addresses[i] = DelimiterUtil.escape(numberMigrator.migrate(address), ' '); - } else if (recipientIds[i].equals("-1")) { + } else if (TextUtils.isEmpty(recipientIds[i]) || recipientIds[i].equals("-1")) { addresses[i] = "Unknown"; } else { - throw new AssertionError("Unable to resolve: " + recipientIds[i]); + throw new AssertionError("Unable to resolve: " + recipientIds[i] + ", recipientIdsList: '" + recipientIdsList + "'"); } if (resolved != null) resolved.close(); @@ -995,10 +995,10 @@ public class DatabaseFactory { if (resolved != null && resolved.moveToFirst()) { String address = resolved.getString(0); addresses[i] = DelimiterUtil.escape(numberMigrator.migrate(address), ' '); - } else if (recipientIds[i].equals("-1")) { + } else if (TextUtils.isEmpty(recipientIds[i]) || recipientIds[i].equals("-1")) { addresses[i] = "Unknown"; } else { - throw new AssertionError("Unable to resolve: " + recipientIds[i]); + throw new AssertionError("Unable to resolve: " + recipientIds[i] + ", recipientIdsList: '" + recipientIdsList + "'"); } if (resolved != null) resolved.close();