fix crash of nil exception in group chats
This commit is contained in:
parent
cba69b8ec8
commit
7987b7b4b9
|
@ -1362,7 +1362,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
if (groupId.length > 0) {
|
||||
NSMutableSet *newMemberIds = [NSMutableSet setWithArray:dataMessage.group.members];
|
||||
NSMutableSet *removedMemberIds = [NSMutableSet setWithArray:dataMessage.group.removedMembers];
|
||||
NSMutableSet *removedMemberIds = [NSMutableSet new];
|
||||
if (dataMessage.group.removedMembers) {
|
||||
removedMemberIds = [NSMutableSet setWithArray:dataMessage.group.removedMembers];
|
||||
}
|
||||
//Ryan TODO: validate the recipientId
|
||||
// for (NSString *recipientId in newMemberIds) {
|
||||
// if (!recipientId.isValidE164) {
|
||||
|
|
|
@ -955,8 +955,9 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
TSOutgoingMessage *message = messageSend.message;
|
||||
NSString *contactID = messageSend.recipient.recipientId;
|
||||
BOOL isGroupMessage = messageSend.thread.isGroupThread;
|
||||
BOOL isPublicChatMessage = isGroupMessage && ((TSGroupThread *)messageSend.thread).isPublicChat;
|
||||
BOOL isDeviceLinkMessage = [message isKindOfClass:LKDeviceLinkMessage.class];
|
||||
if (isGroupMessage || isDeviceLinkMessage) {
|
||||
if (isPublicChatMessage || isDeviceLinkMessage) {
|
||||
[self sendMessage:messageSend];
|
||||
} else {
|
||||
BOOL isSilentMessage = message.isSilent || [message isKindOfClass:LKEphemeralMessage.class] || [message isKindOfClass:OWSOutgoingSyncMessage.class];
|
||||
|
@ -983,6 +984,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
NSArray *slaveDestinations = [destinations filtered:^BOOL(LKDestination *destination) {
|
||||
return [destination.kind isEqual:@"slave"];
|
||||
}];
|
||||
OWSLogInfo(@"Slave deveice for %@ %@", contactID, [slaveDestinations count] > 0 ? slaveDestinations[0] : @"None");
|
||||
// Send to slave destinations (using a best attempt approach (i.e. ignoring the message send result) for now)
|
||||
for (LKDestination *slaveDestination in slaveDestinations) {
|
||||
TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:slaveDestination.hexEncodedPublicKey];
|
||||
|
@ -1003,7 +1005,6 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
|
||||
- (void)sendMessage:(OWSMessageSend *)messageSend
|
||||
{
|
||||
OWSLogInfo(@"message send here %@ %@", messageSend.message.body, messageSend.recipient.recipientId);
|
||||
OWSAssertDebug(messageSend);
|
||||
OWSAssertDebug(messageSend.thread || [messageSend.message isKindOfClass:[OWSOutgoingSyncMessage class]]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue