Fix crash

pull/63/head
Niels Andriesse 6 years ago
parent e6afbe2bfb
commit e2e709e3d2

@ -83,7 +83,7 @@ final class FriendRequestView : UIView {
// MARK: Updating // MARK: Updating
@objc private func handleFriendRequestStatusChangedNotification(_ notification: Notification) { @objc private func handleFriendRequestStatusChangedNotification(_ notification: Notification) {
let messageID = notification.object as! String let messageID = notification.object as! String
guard messageID == message.uniqueId else { return } guard messageID == message.uniqueId && TSMessage.fetch(uniqueId: messageID) != nil else { return } // It's possible for the message to be deleted at this point
message.reload() message.reload()
updateUI() updateUI()
} }

@ -739,7 +739,7 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
// We want to remove any old incoming friend request messages which are pending // We want to remove any old incoming friend request messages which are pending
if (interactionType == OWSInteractionType_IncomingMessage) { if (interactionType == OWSInteractionType_IncomingMessage) {
removeMessage = message.friendRequestStatus == LKMessageFriendRequestStatusPending; removeMessage = YES;
} else { } else {
// Or if we're sending then remove any failed friend request messages // Or if we're sending then remove any failed friend request messages
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message; TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message;

@ -14,7 +14,7 @@ public final class LokiAPI : NSObject {
private static let maxRetryCount: UInt = 8 private static let maxRetryCount: UInt = 8
private static let defaultTimeout: TimeInterval = 20 private static let defaultTimeout: TimeInterval = 20
private static let longPollingTimeout: TimeInterval = 40 private static let longPollingTimeout: TimeInterval = 40
private static let deviceLinkUpdateInterval: TimeInterval = 8 * 60 private static let deviceLinkUpdateInterval: TimeInterval = 60
private static let receivedMessageHashValuesKey = "receivedMessageHashValuesKey" private static let receivedMessageHashValuesKey = "receivedMessageHashValuesKey"
private static let receivedMessageHashValuesCollection = "receivedMessageHashValuesCollection" private static let receivedMessageHashValuesCollection = "receivedMessageHashValuesCollection"
private static var userIDScanLimit: UInt = 4096 private static var userIDScanLimit: UInt = 4096

Loading…
Cancel
Save