Fix crash when ProfileHeaderView tries to create observers after ProfileVC is deinit'd

Can happen if the network is slow and the user closes the profile screen before the header loads
This commit is contained in:
Shadowfacts 2022-11-05 14:42:40 -04:00
parent 999118798c
commit b56c6c37ec
1 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,11 @@ class ProfileHeaderView: UIView {
}
private func createObservers() {
// mastodonController may be nil if the ProfileViewController is deinit'd before the header is even created
guard let mastodonController else {
return
}
cancellables = []
mastodonController.persistentContainer.accountSubject