Prevent crash if BaseStatusTableViewCell is leaked

If prefernces change and the the view controller the cell belongs to is dealloced, the
mastodonController will be nil, previously causing a crash.
This commit is contained in:
Shadowfacts 2020-03-17 21:44:06 -04:00
parent 5e9caf9179
commit ae416bb604
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 1 additions and 1 deletions

View File

@ -191,7 +191,7 @@ class BaseStatusTableViewCell: UITableViewCell {
}
@objc func updateUIForPreferences() {
guard let account = mastodonController.cache.account(for: accountID) else { return }
guard let mastodonController = mastodonController, let account = mastodonController.cache.account(for: accountID) else { return }
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
displayNameLabel.updateForAccountDisplayName(account: account)
attachmentsView.contentHidden = Preferences.shared.blurAllMedia || (mastodonController.cache.status(for: statusID)?.sensitive ?? false)