From 52cfd32e6724e3620c4962e1d161cbf21939f19c Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 28 Oct 2020 13:30:48 +1100 Subject: [PATCH] Fix crash --- Signal/src/Loki/Components/ConversationCell.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Signal/src/Loki/Components/ConversationCell.swift b/Signal/src/Loki/Components/ConversationCell.swift index 9b716bf75..d01f89e93 100644 --- a/Signal/src/Loki/Components/ConversationCell.swift +++ b/Signal/src/Loki/Components/ConversationCell.swift @@ -131,9 +131,11 @@ final class ConversationCell : UITableViewCell { // MARK: Updating private func update() { AssertIsOnMainThread() - MentionsManager.populateUserPublicKeyCacheIfNeeded(for: threadViewModel.threadRecord.uniqueId!) // FIXME: This is a terrible place to do this + let thread = threadViewModel.threadRecord + guard let threadID = thread.uniqueId else { return } + MentionsManager.populateUserPublicKeyCacheIfNeeded(for: threadID) // FIXME: This is a terrible place to do this let isBlocked: Bool - if let thread = threadViewModel.threadRecord as? TSContactThread { + if let thread = thread as? TSContactThread { isBlocked = SSKEnvironment.shared.blockingManager.isRecipientIdBlocked(thread.contactIdentifier()) } else { isBlocked = false @@ -145,10 +147,10 @@ final class ConversationCell : UITableViewCell { accentView.backgroundColor = Colors.accent accentView.alpha = threadViewModel.hasUnreadMessages ? 1 : 0.0001 // Setting the alpha to exactly 0 causes an issue on iOS 12 } - profilePictureView.update(for: threadViewModel.threadRecord) + profilePictureView.update(for: thread) displayNameLabel.text = getDisplayName() timestampLabel.text = DateUtil.formatDateShort(threadViewModel.lastMessageDate) - if SSKEnvironment.shared.typingIndicators.typingRecipientId(forThread: self.threadViewModel.threadRecord) != nil { + if SSKEnvironment.shared.typingIndicators.typingRecipientId(forThread: thread) != nil { snippetLabel.text = "" typingIndicatorView.isHidden = false typingIndicatorView.startAnimation()