Fix crash when ProfileHeaderView leaks

This commit is contained in:
Shadowfacts 2022-02-06 10:20:06 -05:00
parent 804fdb439d
commit 9b33059089
1 changed files with 5 additions and 2 deletions

View File

@ -181,8 +181,11 @@ class ProfileHeaderView: UIView {
}
@objc private func updateUIForPreferences() {
guard let mastodonController = mastodonController,
let account = mastodonController.persistentContainer.account(for: accountID) else {
// todo: mastodonController should never be nil, but ProfileHeaderViews are getting leaked
guard let mastodonController = mastodonController else {
return
}
guard let account = mastodonController.persistentContainer.account(for: accountID) else {
fatalError("Missing cached account \(accountID!)")
}