Don't run UuidMigration if not registered.
This commit is contained in:
parent
b9da012cc4
commit
2924a09936
2 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package org.thoughtcrime.securesms.migrations;
|
package org.thoughtcrime.securesms.migrations;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
@ -52,8 +53,9 @@ public class UuidMigrationJob extends MigrationJob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void performMigration() throws Exception {
|
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.");
|
Log.w(TAG, "Not registered! Skipping migration, as it wouldn't do anything.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchOwnUuid(context);
|
fetchOwnUuid(context);
|
||||||
|
|
|
@ -85,8 +85,10 @@ public final class LiveRecipientCache {
|
||||||
|
|
||||||
if (localUuid != null) {
|
if (localUuid != null) {
|
||||||
localRecipientId = recipientDatabase.getByUuid(localUuid).or(recipientDatabase.getByE164(localE164)).orNull();
|
localRecipientId = recipientDatabase.getByUuid(localUuid).or(recipientDatabase.getByE164(localE164)).orNull();
|
||||||
} else {
|
} else if (localE164 != null) {
|
||||||
localRecipientId = recipientDatabase.getByE164(localE164).orNull();
|
localRecipientId = recipientDatabase.getByE164(localE164).orNull();
|
||||||
|
} else {
|
||||||
|
throw new AssertionError("Tried to call getSelf() before local data was set!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localRecipientId == null) {
|
if (localRecipientId == null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue