forked from shadowfacts/Tusker
Fix crash when preferences are changed before own account is loaded
This commit is contained in:
parent
360f52d0cf
commit
d2f1d78aa2
|
@ -182,12 +182,12 @@ class ProfileHeaderView: UIView {
|
|||
|
||||
@objc private func updateUIForPreferences() {
|
||||
// todo: mastodonController should never be nil, but ProfileHeaderViews are getting leaked
|
||||
guard let mastodonController = mastodonController else {
|
||||
guard let mastodonController = mastodonController,
|
||||
// nil if prefs changed before own account is loaded
|
||||
let accountID = accountID,
|
||||
let account = mastodonController.persistentContainer.account(for: accountID) else {
|
||||
return
|
||||
}
|
||||
guard let account = mastodonController.persistentContainer.account(for: accountID) else {
|
||||
fatalError("Missing cached account \(accountID!)")
|
||||
}
|
||||
|
||||
avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView)
|
||||
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
||||
|
|
Loading…
Reference in New Issue