From f1bf08c1e611ae63821883e66d9efd753c0c7c52 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 31 Jul 2020 23:54:01 +0200 Subject: [PATCH] Update ContactsManager.cpp, WebPagesManager.cpp, and cli.cpp --- td/telegram/ContactsManager.cpp | 2 +- td/telegram/WebPagesManager.cpp | 10 ++++++---- td/telegram/cli.cpp | 2 -- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index c5ce174fd..eed1869a8 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -3041,7 +3041,7 @@ void ContactsManager::on_user_online_timeout(UserId user_id) { } auto u = get_user(user_id); - CHECK(u != nullptr); + if (u == nullptr) { return; } CHECK(u->is_update_user_sent); LOG(INFO) << "Update " << user_id << " online status to offline"; diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 7233e97ac..526eb770a 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -427,6 +427,11 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr LOG(INFO) << "Got empty " << web_page_id; const WebPage *web_page_to_delete = get_web_page(web_page_id); if (web_page_to_delete != nullptr) { + if (web_page_to_delete->logevent_id != 0) { + LOG(INFO) << "Erase " << web_page_id << " from binlog"; + binlog_erase(G()->td_db()->get_binlog(), web_page_to_delete->logevent_id); + web_page_to_delete->logevent_id = 0; + } if (web_page_to_delete->file_source_id.is_valid()) { td_->file_manager_->change_files_source(web_page_to_delete->file_source_id, get_web_page_file_ids(web_page_to_delete), vector()); @@ -737,9 +742,6 @@ void WebPagesManager::unregister_web_page(WebPageId web_page_id, FullMessageId f auto &message_ids = find_message_ids->second; // End custom-patches auto is_deleted = message_ids.erase(full_message_id); - if (!is_deleted) { - return; - } if (!is_deleted) { return; } if (message_ids.empty()) { @@ -1375,7 +1377,7 @@ const WebPagesManager::WebPage *WebPagesManager::get_web_page(WebPageId web_page if (p == web_pages_.end() || p->second == nullptr) { - return make_unique().get(); + return nullptr; } return p->second.get(); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index ba119f080..ae06288e6 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -923,8 +923,6 @@ class CliClient final : public Actor { if (disable_network_) { send_request(td_api::make_object(td_api::make_object())); } - - on_cmd("v0"); } #ifndef USE_READLINE size_t buffer_pos_ = 0;