Add some emptiness checks.

This commit is contained in:
levlam 2024-01-25 19:37:56 +03:00
parent f2262cdcfb
commit c2ccf0d784
2 changed files with 4 additions and 0 deletions

View File

@ -673,6 +673,7 @@ void DialogInviteLinkManager::on_get_dialog_invite_link_info(
const string &invite_link, telegram_api::object_ptr<telegram_api::ChatInvite> &&chat_invite_ptr, const string &invite_link, telegram_api::object_ptr<telegram_api::ChatInvite> &&chat_invite_ptr,
Promise<Unit> &&promise) { Promise<Unit> &&promise) {
CHECK(chat_invite_ptr != nullptr); CHECK(chat_invite_ptr != nullptr);
CHECK(!invite_link.empty());
switch (chat_invite_ptr->get_id()) { switch (chat_invite_ptr->get_id()) {
case telegram_api::chatInviteAlready::ID: case telegram_api::chatInviteAlready::ID:
case telegram_api::chatInvitePeek::ID: { case telegram_api::chatInvitePeek::ID: {
@ -883,6 +884,8 @@ td_api::object_ptr<td_api::chatInviteLinkInfo> DialogInviteLinkManager::get_chat
void DialogInviteLinkManager::add_dialog_access_by_invite_link(DialogId dialog_id, const string &invite_link, void DialogInviteLinkManager::add_dialog_access_by_invite_link(DialogId dialog_id, const string &invite_link,
int32 accessible_before_date) { int32 accessible_before_date) {
CHECK(dialog_id.is_valid());
CHECK(!invite_link.empty());
auto &access = dialog_access_by_invite_link_[dialog_id]; auto &access = dialog_access_by_invite_link_[dialog_id];
access.invite_links.insert(invite_link); access.invite_links.insert(invite_link);
if (access.accessible_before_date < accessible_before_date) { if (access.accessible_before_date < accessible_before_date) {

View File

@ -9036,6 +9036,7 @@ void MessagesManager::on_get_public_dialogs_search_result(const string &query,
auto promises = std::move(it->second); auto promises = std::move(it->second);
search_public_dialogs_queries_.erase(it); search_public_dialogs_queries_.erase(it);
CHECK(!query.empty());
found_public_dialogs_[query] = td_->dialog_manager_->get_peers_dialog_ids(std::move(peers)); 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)); found_on_server_dialogs_[query] = td_->dialog_manager_->get_peers_dialog_ids(std::move(my_peers));