Fix crash when notifications fail to load

This commit is contained in:
Shadowfacts 2021-05-09 21:48:59 -04:00
parent 9ab95dfc43
commit 21e4828a72
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 5 additions and 1 deletions

View File

@ -57,7 +57,10 @@ class NotificationsTableViewController: TimelineLikeTableViewController<Notifica
override func loadInitialItems(completion: @escaping ([NotificationGroup]) -> Void) {
let request = Client.getNotifications(excludeTypes: excludedTypes)
mastodonController.run(request) { (response) in
guard case let .success(notifications, pagination) = response else { fatalError() }
guard case let .success(notifications, pagination) = response else {
completion([])
return
}
let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes)

View File

@ -99,6 +99,7 @@ class ProfileStatusesViewController: TimelineLikeTableViewController<TimelineEnt
guard case let .success(statuses, pagination) = response,
!statuses.isEmpty else {
// todo: error message
completion([])
return
}