forked from shadowfacts/Tusker
Fix crash when notifications fail to load
This commit is contained in:
parent
9ab95dfc43
commit
21e4828a72
|
@ -57,7 +57,10 @@ class NotificationsTableViewController: TimelineLikeTableViewController<Notifica
|
||||||
override func loadInitialItems(completion: @escaping ([NotificationGroup]) -> Void) {
|
override func loadInitialItems(completion: @escaping ([NotificationGroup]) -> Void) {
|
||||||
let request = Client.getNotifications(excludeTypes: excludedTypes)
|
let request = Client.getNotifications(excludeTypes: excludedTypes)
|
||||||
mastodonController.run(request) { (response) in
|
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)
|
let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes)
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ class ProfileStatusesViewController: TimelineLikeTableViewController<TimelineEnt
|
||||||
guard case let .success(statuses, pagination) = response,
|
guard case let .success(statuses, pagination) = response,
|
||||||
!statuses.isEmpty else {
|
!statuses.isEmpty else {
|
||||||
// todo: error message
|
// todo: error message
|
||||||
|
completion([])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue