Prevent empty username

This commit is contained in:
AsamK 2024-01-30 17:59:59 +01:00
parent 2ab5b2817e
commit e13dcdc85a
2 changed files with 7 additions and 1 deletions

View file

@ -473,6 +473,9 @@ public class SignalAccount implements Closeable {
registered = storage.registered;
number = storage.number;
username = storage.username;
if ("".equals(username)) {
username = null;
}
encryptedDeviceName = storage.encryptedDeviceName;
deviceId = storage.deviceId;
isMultiDevice = storage.isMultiDevice;
@ -549,6 +552,9 @@ public class SignalAccount implements Closeable {
registered = Utils.getNotNullNode(rootNode, "registered").asBoolean();
if (rootNode.hasNonNull("usernameIdentifier")) {
username = rootNode.get("usernameIdentifier").asText();
if ("".equals(username)) {
username = null;
}
}
if (rootNode.hasNonNull("uuid")) {
try {

View file

@ -104,7 +104,7 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|| local.hasSeenGroupStoryEducationSheet();
final var username = remote.getUsername() != null && !remote.getUsername().isEmpty()
? remote.getUsername()
: local.getUsername() != null && !local.getUsername().isEmpty() ? local.getUsername() : null;
: local.getUsername();
final var usernameLink = remote.getUsernameLink() != null ? remote.getUsernameLink() : local.getUsernameLink();
final var mergedBuilder = new SignalAccountRecord.Builder(remote.getId().getRaw(), unknownFields).setGivenName(