Make sure completion handler is called when there are no active accounts. Issue #1727

This commit is contained in:
Maurice Parker 2020-01-28 16:24:35 -07:00
parent c6beb3c9dd
commit b53cbfcf2c
1 changed files with 5 additions and 0 deletions

View File

@ -272,6 +272,11 @@ public final class AccountManager: UnreadCountProvider {
var allFetchedArticles = Set<Article>()
let numberOfAccounts = activeAccounts.count
var accountsReporting = 0
guard numberOfAccounts > 0 else {
completion(.success(allFetchedArticles))
return
}
for account in activeAccounts {
account.fetchArticlesAsync(fetchType) { (articleSetResult) in