From 59231e513fa2b23c9492699af20f6ba35c28a6c0 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 27 May 2023 15:38:13 -0700 Subject: [PATCH] Fix crash if status for leaked collection view cell updates --- Tusker/Views/Status/StatusCollectionViewCell.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Status/StatusCollectionViewCell.swift b/Tusker/Views/Status/StatusCollectionViewCell.swift index 77982eb0..5c2dae8d 100644 --- a/Tusker/Views/Status/StatusCollectionViewCell.swift +++ b/Tusker/Views/Status/StatusCollectionViewCell.swift @@ -60,7 +60,8 @@ extension StatusCollectionViewCell { .receive(on: DispatchQueue.main) .filter { [unowned self] in $0 == self.statusID } .sink { [unowned self] _ in - if let status = self.mastodonController.persistentContainer.status(for: self.statusID) { + if let mastodonController = self.mastodonController, + let status = mastodonController.persistentContainer.status(for: self.statusID) { // update immediately w/o animation self.favoriteButton.active = status.favourited self.reblogButton.active = status.reblogged