forked from shadowfacts/Tusker
Fix crash on launch if there are somehow duplicate saved hashtags
This commit is contained in:
parent
b54d34ebfc
commit
1bd4d144a3
|
@ -285,7 +285,7 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
|
||||||
var tabs: [UITab] = []
|
var tabs: [UITab] = []
|
||||||
let savedReq = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
let savedReq = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(savedReq)) ?? []
|
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(savedReq)) ?? []
|
||||||
for hashtag in saved {
|
for hashtag in saved where !seenTags.contains(hashtag.name) {
|
||||||
seenTags.insert(hashtag.name)
|
seenTags.insert(hashtag.name)
|
||||||
tabs.append(HashtagTab(hashtagName: hashtag.name, viewControllerProvider: viewControllerProvider))
|
tabs.append(HashtagTab(hashtagName: hashtag.name, viewControllerProvider: viewControllerProvider))
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,7 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
|
||||||
let followedReq = FollowedHashtag.fetchRequest()
|
let followedReq = FollowedHashtag.fetchRequest()
|
||||||
let followed = (try? mastodonController.persistentContainer.viewContext.fetch(followedReq)) ?? []
|
let followed = (try? mastodonController.persistentContainer.viewContext.fetch(followedReq)) ?? []
|
||||||
for hashtag in followed where !seenTags.contains(hashtag.name) {
|
for hashtag in followed where !seenTags.contains(hashtag.name) {
|
||||||
|
seenTags.insert(hashtag.name)
|
||||||
tabs.append(HashtagTab(hashtagName: hashtag.name, viewControllerProvider: viewControllerProvider))
|
tabs.append(HashtagTab(hashtagName: hashtag.name, viewControllerProvider: viewControllerProvider))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue