Fix crash when AccountTableViewCell is cached by a

SearchResultsTableViewController that has since decremented the
reference count of the cell's account
This commit is contained in:
Shadowfacts 2022-03-29 12:34:54 -04:00
parent 830eea5e95
commit e09b0ff4e3
1 changed files with 2 additions and 1 deletions

View File

@ -36,7 +36,8 @@ class AccountTableViewCell: UITableViewCell {
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
guard let account = mastodonController.persistentContainer.account(for: accountID) else {
fatalError("Missing cached account \(accountID!)")
// this table view cell could be cached in a table view (e.g., SearchResultsViewController) for an account that's since been purged
return
}
displayNameLabel.updateForAccountDisplayName(account: account)