From c2ccf0d7846e01c5dc1de9958fc5e949f4d9a8ef Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 25 Jan 2024 19:37:56 +0300 Subject: [PATCH] Add some emptiness checks. --- td/telegram/DialogInviteLinkManager.cpp | 3 +++ td/telegram/MessagesManager.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/td/telegram/DialogInviteLinkManager.cpp b/td/telegram/DialogInviteLinkManager.cpp index 1e017ce63..62183dbf6 100644 --- a/td/telegram/DialogInviteLinkManager.cpp +++ b/td/telegram/DialogInviteLinkManager.cpp @@ -673,6 +673,7 @@ void DialogInviteLinkManager::on_get_dialog_invite_link_info( const string &invite_link, telegram_api::object_ptr &&chat_invite_ptr, Promise &&promise) { CHECK(chat_invite_ptr != nullptr); + CHECK(!invite_link.empty()); switch (chat_invite_ptr->get_id()) { case telegram_api::chatInviteAlready::ID: case telegram_api::chatInvitePeek::ID: { @@ -883,6 +884,8 @@ td_api::object_ptr DialogInviteLinkManager::get_chat void DialogInviteLinkManager::add_dialog_access_by_invite_link(DialogId dialog_id, const string &invite_link, int32 accessible_before_date) { + CHECK(dialog_id.is_valid()); + CHECK(!invite_link.empty()); auto &access = dialog_access_by_invite_link_[dialog_id]; access.invite_links.insert(invite_link); if (access.accessible_before_date < accessible_before_date) { diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 8924829cc..eb7930779 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -9036,6 +9036,7 @@ void MessagesManager::on_get_public_dialogs_search_result(const string &query, auto promises = std::move(it->second); search_public_dialogs_queries_.erase(it); + CHECK(!query.empty()); found_public_dialogs_[query] = td_->dialog_manager_->get_peers_dialog_ids(std::move(peers)); found_on_server_dialogs_[query] = td_->dialog_manager_->get_peers_dialog_ids(std::move(my_peers));