]> nmode's Git Repositories - signal-cli/commitdiff
Fix deleting a recipient which has no uuid
authorAsamK <asamk@gmx.de>
Mon, 2 May 2022 15:13:30 +0000 (17:13 +0200)
committerAsamK <asamk@gmx.de>
Mon, 2 May 2022 15:13:30 +0000 (17:13 +0200)
Fixes #946

lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java

index 04eeea91e1b03fccdee1eb07917b602f4dcceb88..9caac144b676283325eb871b727492624a6d1d32 100644 (file)
@@ -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()));
         }
     }