Fix crash if status for leaked collection view cell updates

This commit is contained in:
Shadowfacts 2023-05-27 15:38:13 -07:00
parent bf6dfab121
commit 59231e513f
1 changed files with 2 additions and 1 deletions

View File

@ -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