diff --git a/submodules/TelegramCore/Sources/GroupsInCommon.swift b/submodules/TelegramCore/Sources/GroupsInCommon.swift index 2a6d4eb7cf..85e72c3aac 100644 --- a/submodules/TelegramCore/Sources/GroupsInCommon.swift +++ b/submodules/TelegramCore/Sources/GroupsInCommon.swift @@ -66,18 +66,21 @@ private final class GroupsInCommonContextImpl { |> mapToSignal { result -> Signal<([Peer], Int), NoError> in let chats: [Api.Chat] let count: Int? - switch result { - case .none: + if let result = result { + switch result { + case let .chats(apiChats): + chats = apiChats + count = nil + case let .chatsSlice(apiCount, apiChats): + chats = apiChats + count = Int(apiCount) + } + } else { chats = [] count = nil - case let .chats(apiChats): - chats = apiChats - count = nil - case let .chatsSlice(apiCount, apiChats): - chats = apiChats - count = Int(apiCount) } + return postbox.transaction { transaction -> ([Peer], Int) in var peers: [Peer] = [] for chat in chats {