Prevent NPE during migration, when profile key is null

This commit is contained in:
AsamK 2021-05-12 19:34:09 +02:00
parent 21d62c4557
commit 3fc5bec149
3 changed files with 3 additions and 2 deletions

View file

@ -547,8 +547,8 @@ public class SignalAccount implements Closeable {
final var legacyProfileStore = jsonProcessor.convertValue(profileStoreNode, LegacyProfileStore.class);
for (var profileEntry : legacyProfileStore.getProfileEntries()) {
var recipientId = recipientStore.resolveRecipient(profileEntry.getServiceAddress());
recipientStore.storeProfileKey(recipientId, profileEntry.getProfileKey());
recipientStore.storeProfileKeyCredential(recipientId, profileEntry.getProfileKeyCredential());
recipientStore.storeProfileKey(recipientId, profileEntry.getProfileKey());
final var profile = profileEntry.getProfile();
if (profile != null) {
final var capabilities = new HashSet<Profile.Capability>();

View file

@ -226,7 +226,7 @@ public class RecipientStore implements ContactsStore, ProfileStore {
public void storeProfileKey(final RecipientId recipientId, final ProfileKey profileKey) {
synchronized (recipients) {
final var recipient = recipients.get(recipientId);
if (profileKey.equals(recipient.getProfileKey())) {
if (profileKey != null && profileKey.equals(recipient.getProfileKey())) {
return;
}