From ca5ac8b826701be283bcb8cddbfcaf2808cffd66 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 22 Nov 2021 21:38:00 -0500 Subject: [PATCH] Fix crash due to leaked ProfileHeaderView not having a mastodonController --- Tusker/Views/Profile Header/ProfileHeaderView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.swift b/Tusker/Views/Profile Header/ProfileHeaderView.swift index 6f98c6bc..3fc9bc6e 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.swift +++ b/Tusker/Views/Profile Header/ProfileHeaderView.swift @@ -171,9 +171,11 @@ class ProfileHeaderView: UIView { } private func updateRelationship() { - guard let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else { - return - } + // todo: mastodonController should never be nil, but ProfileHeaderViews are getting leaked + guard let mastodonController = mastodonController, + let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else { + return + } followsYouLabel.isHidden = !relationship.followedBy }