From b39c4905c35eb7e8b58e59e653f1bd9e2a551547 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 20 Jun 2017 13:00:38 -0400 Subject: [PATCH] Invalid message adapter cache when app becomes visible. // FREEBIE --- .../ViewControllers/ConversationView/MessagesViewController.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index ceebeeb2a..fe89dd006 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -561,6 +561,8 @@ typedef enum : NSUInteger { // or on another device. [self hideInputIfNeeded]; + self.messageAdapterCache = [[NSCache alloc] init]; + // We need to `beginLongLivedReadTransaction` before we update our // mapping in order to jump to the most recent commit. [self.uiDatabaseConnection beginLongLivedReadTransaction]; @@ -3306,6 +3308,7 @@ typedef enum : NSUInteger { [self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]]; YapCollectionKey *collectionKey = rowChange.collectionKey; + OWSAssert(collectionKey.key.length > 0); if (collectionKey.key) { [self.messageAdapterCache removeObjectForKey:collectionKey.key]; } @@ -3329,6 +3332,7 @@ typedef enum : NSUInteger { } case YapDatabaseViewChangeUpdate: { YapCollectionKey *collectionKey = rowChange.collectionKey; + OWSAssert(collectionKey.key.length > 0); if (collectionKey.key) { [self.messageAdapterCache removeObjectForKey:collectionKey.key]; }