From 2d9eb0c00bd2c254ed28d0b1e72c5956e71022f5 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 24 Mar 2020 00:59:14 +0300 Subject: [PATCH] Do not create *Full if there is no corresponding User/Chat/Channel. GitOrigin-RevId: 8f046c4fb85d5d406f59569a6be2ef7988d3e452 --- td/telegram/ContactsManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index ea75b0c2..322e5b92 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -7693,7 +7693,7 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val } ContactsManager::UserFull *ContactsManager::get_user_full_force(UserId user_id) { - if (!user_id.is_valid()) { + if (!have_user_force(user_id)) { return nullptr; } @@ -7858,7 +7858,7 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val } ContactsManager::ChatFull *ContactsManager::get_chat_full_force(ChatId chat_id) { - if (!chat_id.is_valid()) { + if (!have_chat_force(chat_id)) { return nullptr; } @@ -7934,7 +7934,7 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s } ContactsManager::ChannelFull *ContactsManager::get_channel_full_force(ChannelId channel_id) { - if (!channel_id.is_valid()) { + if (!have_channel_force(channel_id)) { return nullptr; } @@ -8623,6 +8623,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c Chat *c = get_chat(chat_id); if (c == nullptr) { LOG(ERROR) << "Can't find " << chat_id; + return promise.set_value(Unit()); } else if (c->version >= c->pinned_message_version) { LOG(INFO) << "Receive pinned " << pinned_message_id << " in " << chat_id << " with version " << c->version << ". Current version is " << c->pinned_message_version;