Refine asserts around message sending.

This commit is contained in:
Matthew Chen 2018-11-29 14:30:16 -05:00
parent a6cef1c4cc
commit c183aeca8e

View file

@ -1053,6 +1053,17 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
}
}
for (NSDictionary *deviceMessage in deviceMessages) {
NSNumber *_Nullable messageType = deviceMessage[@"type"];
OWSAssertDebug(messageType);
if (messageSend.isUDSend) {
OWSAssertDebug([messageType isEqualToNumber:@(TSUnidentifiedSenderMessageType)]);
} else {
OWSAssertDebug([messageType isEqualToNumber:@(TSEncryptedWhisperMessageType)] ||
[messageType isEqualToNumber:@(TSPreKeyWhisperMessageType)]);
}
}
if (deviceMessages.count == 0) {
// This might happen:
//