mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix a crash on startup — detect when there are no feeds and don’t hit database.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user