diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m index dfc21c6f1..627efd197 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSContactOffersCell () -@property (nonatomic, nullable) OWSContactOffersInteraction *interaction; +@property (nonatomic, nullable, readonly) OWSContactOffersInteraction *interaction; @property (nonatomic) UILabel *titleLabel; @property (nonatomic) UIButton *addToContactsButton; @@ -195,15 +195,19 @@ NS_ASSUME_NONNULL_BEGIN return result; } -- (void)prepareForReuse -{ - [super prepareForReuse]; +#pragma mark - Events - self.interaction = nil; +- (nullable OWSContactOffersInteraction *)interaction +{ + OWSAssert(self.viewItem); + OWSAssert(self.viewItem.interaction); + if (![self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]) { + OWSFail(@"%@ expected OWSContactOffersInteraction but found: %@", self.logTag, self.viewItem.interaction); + return nil; + } + return (OWSContactOffersInteraction *)self.viewItem.interaction; } -#pragma mark - Events - - (void)addToContacts { OWSAssert(self.delegate);