diff --git a/Frameworks/Database/ArticlesTable.swift b/Frameworks/Database/ArticlesTable.swift index 7d6bd1af1..89708a4a7 100644 --- a/Frameworks/Database/ArticlesTable.swift +++ b/Frameworks/Database/ArticlesTable.swift @@ -127,6 +127,11 @@ final class ArticlesTable: DatabaseTable { func fetchUnreadCounts(_ feeds: Set, _ 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, _ callback: @escaping (Int) -> Void) { + if feeds.isEmpty { + callback(0) + return + } + let feedIDs = feeds.feedIDs() queue.fetch { (database) in