From 1285fe088b1bf716756aef46611802870ce8e029 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 15 May 2020 01:43:52 +0200 Subject: [PATCH] Removed checks --- td/telegram/AnimationsManager.cpp | 4 ++- td/telegram/AnimationsManager.hpp | 4 ++- td/telegram/AudiosManager.cpp | 8 ++++-- td/telegram/AudiosManager.hpp | 4 ++- td/telegram/BackgroundManager.cpp | 12 ++++++--- td/telegram/CallbackQueriesManager.cpp | 4 ++- td/telegram/ContactsManager.cpp | 12 ++++++--- td/telegram/Document.hpp | 8 ++++-- td/telegram/MessagesManager.cpp | 20 ++++++++++---- td/telegram/PollManager.hpp | 4 ++- td/telegram/SequenceDispatcher.cpp | 8 ++++-- td/telegram/StickersManager.hpp | 17 ++++++++---- td/telegram/VideoNotesManager.cpp | 28 +++++++++++++++----- td/telegram/VideoNotesManager.hpp | 4 ++- td/telegram/VideosManager.cpp | 16 +++++++++--- td/telegram/VideosManager.hpp | 4 ++- td/telegram/VoiceNotesManager.cpp | 4 ++- td/telegram/VoiceNotesManager.hpp | 4 ++- td/telegram/WebPagesManager.cpp | 36 +++++++++++++++++++------- 19 files changed, 150 insertions(+), 51 deletions(-) diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index aa19b174..406e2ba8 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -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; } diff --git a/td/telegram/AnimationsManager.hpp b/td/telegram/AnimationsManager.hpp index 7052079e..ef14c5c4 100644 --- a/td/telegram/AnimationsManager.hpp +++ b/td/telegram/AnimationsManager.hpp @@ -20,7 +20,9 @@ namespace td { template 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); diff --git a/td/telegram/AudiosManager.cpp b/td/telegram/AudiosManager.cpp index eeeb4cde..6a087528 100644 --- a/td/telegram/AudiosManager.cpp +++ b/td/telegram/AudiosManager.cpp @@ -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 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(audio->duration, audio->title, audio->performer, audio->file_name, audio->mime_type, get_minithumbnail_object(audio->minithumbnail), diff --git a/td/telegram/AudiosManager.hpp b/td/telegram/AudiosManager.hpp index eae2aa2c..ab73a6d3 100644 --- a/td/telegram/AudiosManager.hpp +++ b/td/telegram/AudiosManager.hpp @@ -20,7 +20,9 @@ namespace td { template 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); diff --git a/td/telegram/BackgroundManager.cpp b/td/telegram/BackgroundManager.cpp index 69300f8e..20c0f106 100644 --- a/td/telegram/BackgroundManager.cpp +++ b/td/telegram/BackgroundManager.cpp @@ -137,7 +137,9 @@ class UploadBackgroundQuery : public Td::ResultHandler { void send(FileId file_id, tl_object_ptr &&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); diff --git a/td/telegram/CallbackQueriesManager.cpp b/td/telegram/CallbackQueriesManager.cpp index 11061e5f..e12a7252 100644 --- a/td/telegram/CallbackQueriesManager.cpp +++ b/td/telegram/CallbackQueriesManager.cpp @@ -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; diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 19d66c69..34a8d5f4 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4463,7 +4463,9 @@ void ContactsManager::on_get_blocked_users_result(int32 offset, int32 limit, int vector> &&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 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; diff --git a/td/telegram/Document.hpp b/td/telegram/Document.hpp index a304cc3b..11eb1790 100644 --- a/td/telegram/Document.hpp +++ b/td/telegram/Document.hpp @@ -33,7 +33,9 @@ namespace td { template 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 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) { diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index bd8a0f69..11a9dc6c 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -293,7 +293,9 @@ class GetChannelMessagesQuery : public Td::ResultHandler { void send(ChannelId channel_id, tl_object_ptr &&input_channel, vector> &&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 &&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; diff --git a/td/telegram/PollManager.hpp b/td/telegram/PollManager.hpp index a5ec3e6f..aa82bf01 100644 --- a/td/telegram/PollManager.hpp +++ b/td/telegram/PollManager.hpp @@ -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(); diff --git a/td/telegram/SequenceDispatcher.cpp b/td/telegram/SequenceDispatcher.cpp index 706c846c..4ddecc1f 100644 --- a/td/telegram/SequenceDispatcher.cpp +++ b/td/telegram/SequenceDispatcher.cpp @@ -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); diff --git a/td/telegram/StickersManager.hpp b/td/telegram/StickersManager.hpp index e7f8383c..a02fa39a 100644 --- a/td/telegram/StickersManager.hpp +++ b/td/telegram/StickersManager.hpp @@ -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 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 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); } diff --git a/td/telegram/VideoNotesManager.cpp b/td/telegram/VideoNotesManager.cpp index 8cebe213..7e19c469 100644 --- a/td/telegram/VideoNotesManager.cpp +++ b/td/telegram/VideoNotesManager.cpp @@ -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 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(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(*old_video_note); @@ -211,7 +223,9 @@ tl_object_ptr 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> attributes; attributes.push_back(make_tl_object( diff --git a/td/telegram/VideoNotesManager.hpp b/td/telegram/VideoNotesManager.hpp index 7f198a84..f1db3375 100644 --- a/td/telegram/VideoNotesManager.hpp +++ b/td/telegram/VideoNotesManager.hpp @@ -20,7 +20,9 @@ namespace td { template 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); diff --git a/td/telegram/VideosManager.cpp b/td/telegram/VideosManager.cpp index a614cf04..8b54603c 100644 --- a/td/telegram/VideosManager.cpp +++ b/td/telegram/VideosManager.cpp @@ -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 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( @@ -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(); } diff --git a/td/telegram/VideosManager.hpp b/td/telegram/VideosManager.hpp index 14613973..69ae98c4 100644 --- a/td/telegram/VideosManager.hpp +++ b/td/telegram/VideosManager.hpp @@ -20,7 +20,9 @@ namespace td { template 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); diff --git a/td/telegram/VoiceNotesManager.cpp b/td/telegram/VoiceNotesManager.cpp index 7ba0f8d7..c28de2b0 100644 --- a/td/telegram/VoiceNotesManager.cpp +++ b/td/telegram/VoiceNotesManager.cpp @@ -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; } diff --git a/td/telegram/VoiceNotesManager.hpp b/td/telegram/VoiceNotesManager.hpp index 38046074..b70aa226 100644 --- a/td/telegram/VoiceNotesManager.hpp +++ b/td/telegram/VoiceNotesManager.hpp @@ -18,7 +18,9 @@ namespace td { template 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); diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 5883ea0a..119487b9 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -413,7 +413,9 @@ WebPagesManager::~WebPagesManager() = default; WebPageId WebPagesManager::on_get_web_page(tl_object_ptr &&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 void WebPagesManager::update_web_page(unique_ptr 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 &&message_media_ptr, Promise &&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(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 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 &&page, int32 hash, DialogId owner_dialog_id) { - CHECK(page != nullptr); + if (page == nullptr) { + return; + } std::unordered_map 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 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_;