Removed checks
This commit is contained in:
parent
acecaf8fcb
commit
1285fe088b
@ -145,7 +145,9 @@ void AnimationsManager::tear_down() {
|
||||
|
||||
int32 AnimationsManager::get_animation_duration(FileId file_id) const {
|
||||
auto it = animations_.find(file_id);
|
||||
CHECK(it != animations_.end());
|
||||
if (it == animations_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second->duration;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void AnimationsManager::store_animation(FileId file_id, StorerT &storer) const {
|
||||
auto it = animations_.find(file_id);
|
||||
CHECK(it != animations_.end());
|
||||
if (it == animations_.end()) {
|
||||
return;
|
||||
}
|
||||
const Animation *animation = it->second.get();
|
||||
store(animation->duration, storer);
|
||||
store(animation->dimensions, storer);
|
||||
|
@ -24,7 +24,9 @@ AudiosManager::AudiosManager(Td *td) : td_(td) {
|
||||
|
||||
int32 AudiosManager::get_audio_duration(FileId file_id) const {
|
||||
auto it = audios_.find(file_id);
|
||||
CHECK(it != audios_.end());
|
||||
if (it == audios_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second->duration;
|
||||
}
|
||||
|
||||
@ -34,7 +36,9 @@ tl_object_ptr<td_api::audio> AudiosManager::get_audio_object(FileId file_id) {
|
||||
}
|
||||
|
||||
auto &audio = audios_[file_id];
|
||||
CHECK(audio != nullptr);
|
||||
if (audio == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
audio->is_changed = false;
|
||||
return make_tl_object<td_api::audio>(audio->duration, audio->title, audio->performer, audio->file_name,
|
||||
audio->mime_type, get_minithumbnail_object(audio->minithumbnail),
|
||||
|
@ -20,7 +20,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void AudiosManager::store_audio(FileId file_id, StorerT &storer) const {
|
||||
auto it = audios_.find(file_id);
|
||||
CHECK(it != audios_.end());
|
||||
if (it == audios_.end()) {
|
||||
return;
|
||||
}
|
||||
const Audio *audio = it->second.get();
|
||||
store(audio->file_name, storer);
|
||||
store(audio->mime_type, storer);
|
||||
|
@ -137,7 +137,9 @@ class UploadBackgroundQuery : public Td::ResultHandler {
|
||||
|
||||
void send(FileId file_id, tl_object_ptr<telegram_api::InputFile> &&input_file, const BackgroundType &type,
|
||||
bool for_dark_theme) {
|
||||
CHECK(input_file != nullptr);
|
||||
if (input_file == nullptr) {
|
||||
return;
|
||||
}
|
||||
file_id_ = file_id;
|
||||
type_ = type;
|
||||
for_dark_theme_ = for_dark_theme;
|
||||
@ -690,7 +692,9 @@ void BackgroundManager::on_upload_background_file(FileId file_id, tl_object_ptr<
|
||||
LOG(INFO) << "Background file " << file_id << " has been uploaded";
|
||||
|
||||
auto it = being_uploaded_files_.find(file_id);
|
||||
CHECK(it != being_uploaded_files_.end());
|
||||
if (it == being_uploaded_files_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto type = it->second.type;
|
||||
auto for_dark_theme = it->second.for_dark_theme;
|
||||
@ -711,7 +715,9 @@ void BackgroundManager::on_upload_background_file_error(FileId file_id, Status s
|
||||
CHECK(status.is_error());
|
||||
|
||||
auto it = being_uploaded_files_.find(file_id);
|
||||
CHECK(it != being_uploaded_files_.end());
|
||||
if (it == being_uploaded_files_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto promise = std::move(it->second.promise);
|
||||
|
||||
|
@ -44,7 +44,9 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
|
||||
message_id_ = message_id;
|
||||
|
||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
||||
CHECK(input_peer != nullptr);
|
||||
if (input_peer == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 flags = 0;
|
||||
BufferSlice data;
|
||||
|
@ -4463,7 +4463,9 @@ void ContactsManager::on_get_blocked_users_result(int32 offset, int32 limit, int
|
||||
vector<tl_object_ptr<telegram_api::contactBlocked>> &&blocked_users) {
|
||||
LOG(INFO) << "Receive " << blocked_users.size() << " blocked users out of " << total_count;
|
||||
auto it = found_blocked_users_.find(random_id);
|
||||
CHECK(it != found_blocked_users_.end());
|
||||
if (it == found_blocked_users_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &result = it->second.second;
|
||||
CHECK(result.empty());
|
||||
@ -4481,13 +4483,17 @@ void ContactsManager::on_get_blocked_users_result(int32 offset, int32 limit, int
|
||||
|
||||
void ContactsManager::on_failed_get_blocked_users(int64 random_id) {
|
||||
auto it = found_blocked_users_.find(random_id);
|
||||
CHECK(it != found_blocked_users_.end());
|
||||
if (it == found_blocked_users_.end()) {
|
||||
return;
|
||||
}
|
||||
found_blocked_users_.erase(it);
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::users> ContactsManager::get_blocked_users_object(int64 random_id) {
|
||||
auto it = found_blocked_users_.find(random_id);
|
||||
CHECK(it != found_blocked_users_.end());
|
||||
if (it == found_blocked_users_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto result = get_users_object(it->second.first, it->second.second);
|
||||
found_blocked_users_.erase(it);
|
||||
return result;
|
||||
|
@ -33,7 +33,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void store(const Document &document, StorerT &storer) {
|
||||
Td *td = storer.context()->td().get_actor_unsafe();
|
||||
CHECK(td != nullptr);
|
||||
if (td == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
store(document.type, storer);
|
||||
switch (document.type) {
|
||||
@ -67,7 +69,9 @@ void store(const Document &document, StorerT &storer) {
|
||||
template <class ParserT>
|
||||
void parse(Document &document, ParserT &parser) {
|
||||
Td *td = parser.context()->td().get_actor_unsafe();
|
||||
CHECK(td != nullptr);
|
||||
if (td == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
parse(document.type, parser);
|
||||
switch (document.type) {
|
||||
|
@ -293,7 +293,9 @@ class GetChannelMessagesQuery : public Td::ResultHandler {
|
||||
void send(ChannelId channel_id, tl_object_ptr<telegram_api::InputChannel> &&input_channel,
|
||||
vector<tl_object_ptr<telegram_api::InputMessage>> &&message_ids) {
|
||||
channel_id_ = channel_id;
|
||||
CHECK(input_channel != nullptr);
|
||||
if (input_channel == nullptr) {
|
||||
return;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::channels_getMessages(std::move(input_channel), std::move(message_ids))));
|
||||
}
|
||||
@ -433,7 +435,9 @@ class ExportChannelMessageLinkQuery : public Td::ResultHandler {
|
||||
for_group_ = for_group;
|
||||
ignore_result_ = ignore_result;
|
||||
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
|
||||
CHECK(input_channel != nullptr);
|
||||
if (input_channel == nullptr) {
|
||||
return;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::channels_exportMessageLink(
|
||||
std::move(input_channel), message_id.get_server_message_id().get(), for_group)));
|
||||
}
|
||||
@ -572,7 +576,9 @@ class GetCommonDialogsQuery : public Td::ResultHandler {
|
||||
LOG(INFO) << "Get common dialogs with " << user_id << " from " << offset_chat_id << " with limit " << limit;
|
||||
|
||||
auto input_user = td->contacts_manager_->get_input_user(user_id);
|
||||
CHECK(input_user != nullptr);
|
||||
if (input_user == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::messages_getCommonChats(std::move(input_user), offset_chat_id, limit)));
|
||||
@ -696,7 +702,9 @@ class EditDialogPhotoQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, FileId file_id, tl_object_ptr<telegram_api::InputChatPhoto> &&input_chat_photo) {
|
||||
CHECK(input_chat_photo != nullptr);
|
||||
if (input_chat_photo == nullptr) {
|
||||
return;
|
||||
}
|
||||
file_id_ = file_id;
|
||||
was_uploaded_ = FileManager::extract_was_uploaded(input_chat_photo);
|
||||
file_reference_ = FileManager::extract_file_reference(input_chat_photo);
|
||||
@ -710,7 +718,9 @@ class EditDialogPhotoQuery : public Td::ResultHandler {
|
||||
case DialogType::Channel: {
|
||||
auto channel_id = dialog_id.get_channel_id();
|
||||
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
|
||||
CHECK(input_channel != nullptr);
|
||||
if (input_channel == nullptr) {
|
||||
return;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::channels_editPhoto(std::move(input_channel), std::move(input_chat_photo))));
|
||||
break;
|
||||
|
@ -128,7 +128,9 @@ void PollManager::store_poll(PollId poll_id, StorerT &storer) const {
|
||||
td::store(poll_id.get(), storer);
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
auto poll = get_poll(poll_id);
|
||||
CHECK(poll != nullptr);
|
||||
if (poll == nullptr) {
|
||||
return;
|
||||
}
|
||||
bool has_open_period = poll->open_period != 0;
|
||||
bool has_close_date = poll->close_date != 0;
|
||||
bool has_explanation = !poll->explanation.text.empty();
|
||||
|
@ -255,13 +255,17 @@ void MultiSequenceDispatcher::send_with_callback(NetQueryPtr query, ActorShared<
|
||||
|
||||
void MultiSequenceDispatcher::on_result() {
|
||||
auto it = dispatchers_.find(get_link_token());
|
||||
CHECK(it != dispatchers_.end());
|
||||
if (it == dispatchers_.end()) {
|
||||
return;
|
||||
}
|
||||
it->second.cnt_--;
|
||||
}
|
||||
|
||||
void MultiSequenceDispatcher::ready_to_close() {
|
||||
auto it = dispatchers_.find(get_link_token());
|
||||
CHECK(it != dispatchers_.end());
|
||||
if (it == dispatchers_.end()) {
|
||||
return;
|
||||
}
|
||||
if (it->second.cnt_ == 0) {
|
||||
LOG(DEBUG) << "Close SequenceDispatcher " << get_link_token();
|
||||
dispatchers_.erase(it);
|
||||
|
@ -38,8 +38,9 @@ void StickersManager::store_sticker(FileId file_id, bool in_sticker_set, StorerT
|
||||
store(sticker->set_id.get(), storer);
|
||||
if (has_sticker_set_access_hash) {
|
||||
auto sticker_set = get_sticker_set(sticker->set_id);
|
||||
CHECK(sticker_set != nullptr);
|
||||
store(sticker_set->access_hash, storer);
|
||||
if (sticker_set != nullptr) {
|
||||
store(sticker_set->access_hash, storer);
|
||||
}
|
||||
}
|
||||
}
|
||||
store(sticker->alt, storer);
|
||||
@ -170,7 +171,9 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with
|
||||
|
||||
template <class ParserT>
|
||||
void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser) {
|
||||
CHECK(sticker_set != nullptr);
|
||||
if (sticker_set == nullptr) {
|
||||
return;
|
||||
}
|
||||
CHECK(!sticker_set->was_loaded);
|
||||
bool was_inited = sticker_set->is_inited;
|
||||
bool is_installed;
|
||||
@ -271,7 +274,9 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
|
||||
sticker_set->sticker_ids.push_back(sticker_id);
|
||||
|
||||
Sticker *sticker = get_sticker(sticker_id);
|
||||
CHECK(sticker != nullptr);
|
||||
if (sticker == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (sticker->set_id != sticker_set->id) {
|
||||
LOG_IF(ERROR, sticker->set_id.is_valid()) << "Sticker " << sticker_id << " set_id has changed";
|
||||
sticker->set_id = sticker_set->id;
|
||||
@ -300,7 +305,9 @@ template <class StorerT>
|
||||
void StickersManager::store_sticker_set_id(StickerSetId sticker_set_id, StorerT &storer) const {
|
||||
CHECK(sticker_set_id.is_valid());
|
||||
const StickerSet *sticker_set = get_sticker_set(sticker_set_id);
|
||||
CHECK(sticker_set != nullptr);
|
||||
if (sticker_set == nullptr) {
|
||||
return;
|
||||
}
|
||||
store(sticker_set_id.get(), storer);
|
||||
store(sticker_set->access_hash, storer);
|
||||
}
|
||||
|
@ -25,7 +25,9 @@ VideoNotesManager::VideoNotesManager(Td *td) : td_(td) {
|
||||
|
||||
int32 VideoNotesManager::get_video_note_duration(FileId file_id) const {
|
||||
auto it = video_notes_.find(file_id);
|
||||
CHECK(it != video_notes_.end());
|
||||
if (it == video_notes_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second->duration;
|
||||
}
|
||||
|
||||
@ -35,7 +37,9 @@ tl_object_ptr<td_api::videoNote> VideoNotesManager::get_video_note_object(FileId
|
||||
}
|
||||
|
||||
auto &video_note = video_notes_[file_id];
|
||||
CHECK(video_note != nullptr);
|
||||
if (video_note == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
video_note->is_changed = false;
|
||||
|
||||
return make_tl_object<td_api::videoNote>(video_note->duration, video_note->dimensions.width,
|
||||
@ -83,25 +87,33 @@ const VideoNotesManager::VideoNote *VideoNotesManager::get_video_note(FileId fil
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CHECK(video_note->second->file_id == file_id);
|
||||
if (video_note->second->file_id != file_id) {
|
||||
return nullptr;
|
||||
}
|
||||
return video_note->second.get();
|
||||
}
|
||||
|
||||
FileId VideoNotesManager::get_video_note_thumbnail_file_id(FileId file_id) const {
|
||||
auto video_note = get_video_note(file_id);
|
||||
CHECK(video_note != nullptr);
|
||||
if (video_note == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return video_note->thumbnail.file_id;
|
||||
}
|
||||
|
||||
void VideoNotesManager::delete_video_note_thumbnail(FileId file_id) {
|
||||
auto &video_note = video_notes_[file_id];
|
||||
CHECK(video_note != nullptr);
|
||||
if (video_note == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
video_note->thumbnail = PhotoSize();
|
||||
}
|
||||
|
||||
FileId VideoNotesManager::dup_video_note(FileId new_id, FileId old_id) {
|
||||
const VideoNote *old_video_note = get_video_note(old_id);
|
||||
CHECK(old_video_note != nullptr);
|
||||
if (old_video_note == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto &new_video_note = video_notes_[new_id];
|
||||
CHECK(!new_video_note);
|
||||
new_video_note = make_unique<VideoNote>(*old_video_note);
|
||||
@ -211,7 +223,9 @@ tl_object_ptr<telegram_api::InputMedia> VideoNotesManager::get_input_media(
|
||||
|
||||
if (input_file != nullptr) {
|
||||
const VideoNote *video_note = get_video_note(file_id);
|
||||
CHECK(video_note != nullptr);
|
||||
if (video_note == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vector<tl_object_ptr<telegram_api::DocumentAttribute>> attributes;
|
||||
attributes.push_back(make_tl_object<telegram_api::documentAttributeVideo>(
|
||||
|
@ -20,7 +20,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void VideoNotesManager::store_video_note(FileId file_id, StorerT &storer) const {
|
||||
auto it = video_notes_.find(file_id);
|
||||
CHECK(it != video_notes_.end());
|
||||
if (it == video_notes_.end()) {
|
||||
return;
|
||||
}
|
||||
const VideoNote *video_note = it->second.get();
|
||||
store(video_note->duration, storer);
|
||||
store(video_note->dimensions, storer);
|
||||
|
@ -24,7 +24,9 @@ VideosManager::VideosManager(Td *td) : td_(td) {
|
||||
|
||||
int32 VideosManager::get_video_duration(FileId file_id) const {
|
||||
auto it = videos_.find(file_id);
|
||||
CHECK(it != videos_.end());
|
||||
if (it == videos_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second->duration;
|
||||
}
|
||||
|
||||
@ -34,7 +36,9 @@ tl_object_ptr<td_api::video> VideosManager::get_video_object(FileId file_id) {
|
||||
}
|
||||
|
||||
auto &video = videos_[file_id];
|
||||
CHECK(video != nullptr);
|
||||
if (video == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
video->is_changed = false;
|
||||
|
||||
return make_tl_object<td_api::video>(
|
||||
@ -108,13 +112,17 @@ const VideosManager::Video *VideosManager::get_video(FileId file_id) const {
|
||||
|
||||
FileId VideosManager::get_video_thumbnail_file_id(FileId file_id) const {
|
||||
auto video = get_video(file_id);
|
||||
CHECK(video != nullptr);
|
||||
if (video == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return video->thumbnail.file_id;
|
||||
}
|
||||
|
||||
void VideosManager::delete_video_thumbnail(FileId file_id) {
|
||||
auto &video = videos_[file_id];
|
||||
CHECK(video != nullptr);
|
||||
if (video == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
video->thumbnail = PhotoSize();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void VideosManager::store_video(FileId file_id, StorerT &storer) const {
|
||||
auto it = videos_.find(file_id);
|
||||
CHECK(it != videos_.end());
|
||||
if (it == videos_.end()) {
|
||||
return;
|
||||
}
|
||||
const Video *video = it->second.get();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(video->has_stickers);
|
||||
|
@ -25,7 +25,9 @@ VoiceNotesManager::VoiceNotesManager(Td *td) : td_(td) {
|
||||
|
||||
int32 VoiceNotesManager::get_voice_note_duration(FileId file_id) const {
|
||||
auto it = voice_notes_.find(file_id);
|
||||
CHECK(it != voice_notes_.end());
|
||||
if (it == voice_notes_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second->duration;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,9 @@ namespace td {
|
||||
template <class StorerT>
|
||||
void VoiceNotesManager::store_voice_note(FileId file_id, StorerT &storer) const {
|
||||
auto it = voice_notes_.find(file_id);
|
||||
CHECK(it != voice_notes_.end());
|
||||
if (it == voice_notes_.end()) {
|
||||
return;
|
||||
}
|
||||
const VoiceNote *voice_note = it->second.get();
|
||||
store(voice_note->mime_type, storer);
|
||||
store(voice_note->duration, storer);
|
||||
|
@ -413,7 +413,9 @@ WebPagesManager::~WebPagesManager() = default;
|
||||
|
||||
WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage> &&web_page_ptr,
|
||||
DialogId owner_dialog_id) {
|
||||
CHECK(web_page_ptr != nullptr);
|
||||
if (web_page_ptr == nullptr) {
|
||||
return WebPageId();
|
||||
}
|
||||
LOG(DEBUG) << "Got " << to_string(web_page_ptr);
|
||||
switch (web_page_ptr->get_id()) {
|
||||
case telegram_api::webPageEmpty::ID: {
|
||||
@ -540,7 +542,9 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
|
||||
void WebPagesManager::update_web_page(unique_ptr<WebPage> web_page, WebPageId web_page_id, bool from_binlog,
|
||||
bool from_database) {
|
||||
LOG(INFO) << "Update " << web_page_id;
|
||||
CHECK(web_page != nullptr);
|
||||
if (web_page == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &page = web_pages_[web_page_id];
|
||||
auto old_file_ids = get_web_page_file_ids(page.get());
|
||||
@ -730,7 +734,9 @@ void WebPagesManager::unregister_web_page(WebPageId web_page_id, FullMessageId f
|
||||
void WebPagesManager::on_get_web_page_preview_success(int64 request_id, const string &url,
|
||||
tl_object_ptr<telegram_api::MessageMedia> &&message_media_ptr,
|
||||
Promise<Unit> &&promise) {
|
||||
CHECK(message_media_ptr != nullptr);
|
||||
if (message_media_ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32 constructor_id = message_media_ptr->get_id();
|
||||
if (constructor_id != telegram_api::messageMediaWebPage::ID) {
|
||||
if (constructor_id == telegram_api::messageMediaEmpty::ID) {
|
||||
@ -745,7 +751,9 @@ void WebPagesManager::on_get_web_page_preview_success(int64 request_id, const st
|
||||
}
|
||||
|
||||
auto message_media_web_page = move_tl_object_as<telegram_api::messageMediaWebPage>(message_media_ptr);
|
||||
CHECK(message_media_web_page->webpage_ != nullptr);
|
||||
if (message_media_web_page->webpage_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto web_page_id = on_get_web_page(std::move(message_media_web_page->webpage_), DialogId());
|
||||
if (web_page_id.is_valid() && !have_web_page(web_page_id)) {
|
||||
@ -824,7 +832,9 @@ tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_preview_result(int6
|
||||
}
|
||||
|
||||
auto it = got_web_page_previews_.find(request_id);
|
||||
CHECK(it != got_web_page_previews_.end());
|
||||
if (it == got_web_page_previews_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto web_page_id = it->second;
|
||||
got_web_page_previews_.erase(it);
|
||||
return get_web_page_object(web_page_id);
|
||||
@ -885,7 +895,9 @@ void WebPagesManager::load_web_page_instant_view(WebPageId web_page_id, bool for
|
||||
LOG(INFO) << "Load " << web_page_id << " instant view, have " << previous_queries << " previous queries";
|
||||
if (previous_queries == 0) {
|
||||
const WebPageInstantView *web_page_instant_view = get_web_page_instant_view(web_page_id);
|
||||
CHECK(web_page_instant_view != nullptr);
|
||||
if (web_page_instant_view == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (G()->parameters().use_message_db && !web_page_instant_view->was_loaded_from_database) {
|
||||
LOG(INFO) << "Trying to load " << web_page_id << " instant view from database";
|
||||
@ -1382,7 +1394,9 @@ void WebPagesManager::on_pending_web_page_timeout(WebPageId web_page_id) {
|
||||
|
||||
void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ptr<telegram_api::page> &&page,
|
||||
int32 hash, DialogId owner_dialog_id) {
|
||||
CHECK(page != nullptr);
|
||||
if (page == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::unordered_map<int64, Photo> photos;
|
||||
for (auto &photo_ptr : page->photos_) {
|
||||
Photo photo = get_photo(td_->file_manager_.get(), std::move(photo_ptr), owner_dialog_id);
|
||||
@ -1497,7 +1511,9 @@ void WebPagesManager::save_web_page(const WebPage *web_page, WebPageId web_page_
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK(web_page != nullptr);
|
||||
if (web_page == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!from_binlog) {
|
||||
WebPageLogEvent logevent(web_page_id, web_page);
|
||||
LogEventStorerImpl<WebPageLogEvent> storer(logevent);
|
||||
@ -1533,7 +1549,9 @@ void WebPagesManager::on_binlog_web_page_event(BinlogEvent &&event) {
|
||||
auto web_page_id = log_event.web_page_id;
|
||||
LOG(INFO) << "Add " << web_page_id << " from binlog";
|
||||
auto web_page = std::move(log_event.web_page_out);
|
||||
CHECK(web_page != nullptr);
|
||||
if (web_page == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
web_page->logevent_id = event.id_;
|
||||
|
||||
|
Reference in New Issue
Block a user