From 60565f96252496746773b174ec193f579616ad65 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 15 Aug 2020 17:37:56 -0400 Subject: [PATCH] Fix crash if status table view cell outlives VC --- Tusker/Views/Status/BaseStatusTableViewCell.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index ee3e567b..7e5293e5 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -102,7 +102,8 @@ class BaseStatusTableViewCell: UITableViewCell { .filter { [unowned self] in $0 == self.statusID } .receive(on: DispatchQueue.main) .sink { [unowned self] in - if let status = self.mastodonController.persistentContainer.status(for: $0) { + if let mastodonController = mastodonController, + let status = mastodonController.persistentContainer.status(for: $0) { self.updateStatusState(status: status) } } @@ -113,7 +114,8 @@ class BaseStatusTableViewCell: UITableViewCell { .filter { [unowned self] in $0 == self.accountID } .receive(on: DispatchQueue.main) .sink { [unowned self] in - if let account = self.mastodonController.persistentContainer.account(for: $0) { + if let mastodonController = mastodonController, + let account = mastodonController.persistentContainer.account(for: $0) { self.updateUI(account: account) } }