Fix crash when trying to cache an empty timeline

This commit is contained in:
Thomas Ricouard 2023-02-02 21:21:07 +01:00
parent e278eae144
commit fcb7ddcbdb
1 changed files with 1 additions and 0 deletions

View File

@ -10,6 +10,7 @@ actor TimelineCache {
private init() {}
func set(statuses: [Status], client: Client) {
guard !statuses.isEmpty else { return }
memoryCache[client] = statuses.prefix(upTo: min(100, statuses.count - 1)).map { $0 }
}