From d4e6c3724d9313861af85a502847718c78257c1c Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 7 Dec 2020 00:58:54 +0300 Subject: [PATCH] Do not allow to join already joined call. --- td/telegram/GroupCallManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 30bf0e76f..7b8e5bfcf 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -609,6 +609,13 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, Promise> &&promise) { TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id)); + auto *group_call = get_group_call(input_group_call_id); + CHECK(group_call != nullptr); + if (group_call->is_joined) { + CHECK(group_call->is_inited); + return promise.set_error(Status::Error(400, "Group call is already joined")); + } + if (pending_join_requests_.count(input_group_call_id)) { auto it = pending_join_requests_.find(input_group_call_id); CHECK(it != pending_join_requests_.end());