mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 09:11:13 +01:00
Fix a crash on startup — detect when there are no feeds and don’t hit database.
This commit is contained in:
parent
97079108be
commit
9865bd8e51
@ -127,6 +127,11 @@ final class ArticlesTable: DatabaseTable {
|
||||
|
||||
func fetchUnreadCounts(_ feeds: Set<Feed>, _ completion: @escaping UnreadCountCompletionBlock) {
|
||||
|
||||
if feeds.isEmpty {
|
||||
completion(UnreadCountDictionary())
|
||||
return
|
||||
}
|
||||
|
||||
let feedIDs = feeds.feedIDs()
|
||||
var unreadCountDictionary = UnreadCountDictionary()
|
||||
|
||||
@ -146,6 +151,11 @@ final class ArticlesTable: DatabaseTable {
|
||||
|
||||
// Get unread count for today, for instance.
|
||||
|
||||
if feeds.isEmpty {
|
||||
callback(0)
|
||||
return
|
||||
}
|
||||
|
||||
let feedIDs = feeds.feedIDs()
|
||||
queue.fetch { (database) in
|
||||
|
||||
@ -166,6 +176,11 @@ final class ArticlesTable: DatabaseTable {
|
||||
|
||||
func fetchStarredAndUnreadCount(_ feeds: Set<Feed>, _ callback: @escaping (Int) -> Void) {
|
||||
|
||||
if feeds.isEmpty {
|
||||
callback(0)
|
||||
return
|
||||
}
|
||||
|
||||
let feedIDs = feeds.feedIDs()
|
||||
queue.fetch { (database) in
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user