From 9cb1409918fe151422cc557997aa5691c01284b6 Mon Sep 17 00:00:00 2001 From: AsamK Date: Sun, 24 Oct 2021 20:46:33 +0200 Subject: [PATCH] Fix unlikely issues with null values --- .../manager/storage/senderKeys/SenderKeyRecordStore.java | 4 ++-- .../java/org/asamk/signal/manager/util/MessageCacheUtils.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/senderKeys/SenderKeyRecordStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/senderKeys/SenderKeyRecordStore.java index f84903e4..f0bbddc6 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/senderKeys/SenderKeyRecordStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/senderKeys/SenderKeyRecordStore.java @@ -95,7 +95,7 @@ public class SenderKeyRecordStore implements org.whispersystems.libsignal.groups return; } - logger.debug("Only to be merged recipient had sender keys, re-assigning to the new recipient."); + logger.debug("To be merged recipient had sender keys, re-assigning to the new recipient."); for (var key : keys) { final var toBeMergedSenderKey = loadSenderKeyLocked(key); deleteSenderKeyLocked(key); @@ -108,7 +108,7 @@ public class SenderKeyRecordStore implements org.whispersystems.libsignal.groups if (senderKeyRecord != null) { continue; } - storeSenderKeyLocked(newKey, senderKeyRecord); + storeSenderKeyLocked(newKey, toBeMergedSenderKey); } } } diff --git a/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java b/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java index 66b14296..ed94f39e 100644 --- a/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/util/MessageCacheUtils.java @@ -59,7 +59,7 @@ public class MessageCacheUtils { if (version >= 4) { serverDeliveredTimestamp = in.readLong(); } - Optional addressOptional = sourceUuid == null && source.isEmpty() + Optional addressOptional = sourceUuid == null ? Optional.absent() : Optional.of(new SignalServiceAddress(sourceUuid, source)); return new SignalServiceEnvelope(type,