From 5837a6982b1274952868b9ff68475a0ac9e512b2 Mon Sep 17 00:00:00 2001 From: AsamK Date: Mon, 2 May 2022 17:13:30 +0200 Subject: [PATCH] Fix deleting a recipient which has no uuid Fixes #946 --- .../manager/storage/recipients/RecipientStore.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java index 04eeea91..9caac144 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java @@ -279,11 +279,13 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile synchronized (recipients) { logger.debug("Deleting recipient data for {}", recipientId); final var recipient = recipients.get(recipientId); - storeRecipientLocked(recipientId, - Recipient.newBuilder() - .withRecipientId(recipientId) - .withAddress(new RecipientAddress(recipient.getAddress().uuid().orElse(null))) - .build()); + recipient.getAddress() + .uuid() + .ifPresent(uuid -> storeRecipientLocked(recipientId, + Recipient.newBuilder() + .withRecipientId(recipientId) + .withAddress(new RecipientAddress(uuid)) + .build())); } }