From ea18ceae4adfaed63879673fa0109778caf97fbd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 29 May 2016 21:25:27 +0200 Subject: [PATCH] avoid npe when sending omemo messages to group --- .../eu/siacs/conversations/generator/MessageGenerator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index 823af397..09c88293 100644 --- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -12,6 +12,7 @@ import java.util.TimeZone; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.services.XmppConnectionService; @@ -81,7 +82,8 @@ public class MessageGenerator extends AbstractGenerator { } private static boolean recipientSupportsOmemo(Message message) { - return message.getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY); + Contact c = message.getContact(); + return c != null && c.getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY); } public static void addMessageHints(MessagePacket packet) {