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
This commit is contained in:
Moxie Marlinspike 2017-08-03 09:32:56 -07:00
parent 9a78615991
commit cb4303ac23

View File

@ -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();