Prevent crash when displaying accounts with no pinned statuses

This commit is contained in:
Shadowfacts 2020-06-23 22:21:50 -04:00
parent cf5b97d9c8
commit 986fc5b833
1 changed files with 1 additions and 0 deletions

View File

@ -109,6 +109,7 @@ class ProfileTableViewController: EnhancedTableViewController {
getStatuses(onlyPinned: true) { (response) in getStatuses(onlyPinned: true) { (response) in
guard case let .success(statuses, _) = response else { fatalError() } guard case let .success(statuses, _) = response else { fatalError() }
if statuses.isEmpty { return }
self.mastodonController.persistentContainer.addAll(statuses: statuses) { self.mastodonController.persistentContainer.addAll(statuses: statuses) {
self.pinnedStatuses = statuses.map { ($0.id, .unknown) } self.pinnedStatuses = statuses.map { ($0.id, .unknown) }