]> nmode's Git Repositories - signal-cli/commitdiff
Fix handling data messages of sync messages
authorAsamK <asamk@gmx.de>
Thu, 24 Dec 2020 17:05:12 +0000 (18:05 +0100)
committerAsamK <asamk@gmx.de>
Thu, 24 Dec 2020 17:05:12 +0000 (18:05 +0100)
src/main/java/org/asamk/signal/manager/Manager.java

index 4c10a5298e47e8acdd894ad2a895f090de2b9dc7..e02106b93eba922325dbb455a5b10a6ae0464fa3 100644 (file)
@@ -1621,7 +1621,7 @@ public class Manager implements Closeable {
         }
 
         final SignalServiceAddress conversationPartnerAddress = isSync ? destination : source;
         }
 
         final SignalServiceAddress conversationPartnerAddress = isSync ? destination : source;
-        if (message.isEndSession()) {
+        if (conversationPartnerAddress != null && message.isEndSession()) {
             handleEndSession(conversationPartnerAddress);
         }
         if (message.isExpirationUpdate() || message.getBody().isPresent()) {
             handleEndSession(conversationPartnerAddress);
         }
         if (message.isExpirationUpdate() || message.getBody().isPresent()) {
@@ -1638,7 +1638,7 @@ public class Manager implements Closeable {
                 } else if (message.getGroupContext().get().getGroupV2().isPresent()) {
                     // disappearing message timer already stored in the DecryptedGroup
                 }
                 } else if (message.getGroupContext().get().getGroupV2().isPresent()) {
                     // disappearing message timer already stored in the DecryptedGroup
                 }
-            } else {
+            } else if (conversationPartnerAddress != null) {
                 ContactInfo contact = account.getContactStore().getContact(conversationPartnerAddress);
                 if (contact == null) {
                     contact = new ContactInfo(conversationPartnerAddress);
                 ContactInfo contact = account.getContactStore().getContact(conversationPartnerAddress);
                 if (contact == null) {
                     contact = new ContactInfo(conversationPartnerAddress);
@@ -2025,13 +2025,11 @@ public class Manager implements Closeable {
                 if (syncMessage.getSent().isPresent()) {
                     SentTranscriptMessage message = syncMessage.getSent().get();
                     final SignalServiceAddress destination = message.getDestination().orNull();
                 if (syncMessage.getSent().isPresent()) {
                     SentTranscriptMessage message = syncMessage.getSent().get();
                     final SignalServiceAddress destination = message.getDestination().orNull();
-                    if (destination != null) {
-                        actions.addAll(handleSignalServiceDataMessage(message.getMessage(),
-                                true,
-                                sender,
-                                destination,
-                                ignoreAttachments));
-                    }
+                    actions.addAll(handleSignalServiceDataMessage(message.getMessage(),
+                            true,
+                            sender,
+                            destination,
+                            ignoreAttachments));
                 }
                 if (syncMessage.getRequest().isPresent()) {
                     RequestMessage rm = syncMessage.getRequest().get();
                 }
                 if (syncMessage.getRequest().isPresent()) {
                     RequestMessage rm = syncMessage.getRequest().get();