Don't run UuidMigration if not registered.

master
Greyson Parrelli 2019-11-13 10:42:37 -05:00 committed by Alan Evans
parent b9da012cc4
commit 2924a09936
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.migrations;
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@ -52,8 +53,9 @@ public class UuidMigrationJob extends MigrationJob {
@Override
void performMigration() throws Exception {
if (!TextSecurePreferences.isPushRegistered(context)) {
if (!TextSecurePreferences.isPushRegistered(context) || TextUtils.isEmpty(TextSecurePreferences.getLocalNumber(context))) {
Log.w(TAG, "Not registered! Skipping migration, as it wouldn't do anything.");
return;
}
fetchOwnUuid(context);

View File

@ -85,8 +85,10 @@ public final class LiveRecipientCache {
if (localUuid != null) {
localRecipientId = recipientDatabase.getByUuid(localUuid).or(recipientDatabase.getByE164(localE164)).orNull();
} else {
} else if (localE164 != null) {
localRecipientId = recipientDatabase.getByE164(localE164).orNull();
} else {
throw new AssertionError("Tried to call getSelf() before local data was set!");
}
if (localRecipientId == null) {