fix crash when adding duplicate mute items
Changelog-Fixed: Fix crash when adding duplicate mute items Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -111,12 +111,16 @@ class MutelistManager {
|
|||||||
private func add_mute_item(_ item: MuteItem) {
|
private func add_mute_item(_ item: MuteItem) {
|
||||||
switch item {
|
switch item {
|
||||||
case .user(_, _):
|
case .user(_, _):
|
||||||
|
guard !users.contains(item) else { return }
|
||||||
users.insert(item)
|
users.insert(item)
|
||||||
case .hashtag(_, _):
|
case .hashtag(_, _):
|
||||||
|
guard !hashtags.contains(item) else { return }
|
||||||
hashtags.insert(item)
|
hashtags.insert(item)
|
||||||
case .word(_, _):
|
case .word(_, _):
|
||||||
|
guard !words.contains(item) else { return }
|
||||||
words.insert(item)
|
words.insert(item)
|
||||||
case .thread(_, _):
|
case .thread(_, _):
|
||||||
|
guard !threads.contains(item) else { return }
|
||||||
threads.insert(item)
|
threads.insert(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user