avoid npe when sending omemo messages to group

This commit is contained in:
Daniel Gultsch 2016-05-29 21:25:27 +02:00
parent 71787bd2e1
commit ea18ceae4a

View File

@ -12,6 +12,7 @@ import java.util.TimeZone;
import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
@ -81,7 +82,8 @@ public class MessageGenerator extends AbstractGenerator {
} }
private static boolean recipientSupportsOmemo(Message message) { 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) { public static void addMessageHints(MessagePacket packet) {