diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 9a9891fe0..fe6034403 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -9145,7 +9145,7 @@ void ContactsManager::reload_created_public_dialogs(PublicDialogType type, } void ContactsManager::finish_get_created_public_dialogs(PublicDialogType type, Result &&result) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 172737968..83f4d1460 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -1438,7 +1438,7 @@ void GroupCallManager::reload_group_call(InputGroupCallId input_group_call_id, void GroupCallManager::finish_get_group_call(InputGroupCallId input_group_call_id, Result> &&result) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 142af97df..d3682e268 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -23977,7 +23977,7 @@ MessagesManager::FoundMessages MessagesManager::offline_search_messages(DialogId void MessagesManager::on_message_db_fts_result(Result result, string offset, int32 limit, int64 random_id, Promise &&promise) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } if (result.is_error()) { @@ -24009,7 +24009,7 @@ void MessagesManager::on_message_db_fts_result(Result result void MessagesManager::on_message_db_calls_result(Result result, int64 random_id, MessageId first_db_message_id, MessageSearchFilter filter, Promise &&promise) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } if (result.is_error()) { @@ -30191,7 +30191,7 @@ void MessagesManager::upload_imported_message_attachment(DialogId dialog_id, int } void MessagesManager::on_imported_message_attachments_uploaded(int64 random_id, Result &&result) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } @@ -30920,7 +30920,7 @@ void MessagesManager::on_get_message_notifications_from_database(DialogId dialog int32 limit, Result> result, Promise> promise) { - if (G()->close_flag()) { + if (G()->close_flag() && result.is_ok()) { result = Global::request_aborted_error(); } if (result.is_error()) { diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 17b352926..6f01df3c8 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -975,7 +975,7 @@ void WebPagesManager::on_load_web_page_instant_view_from_database(WebPageId web_ void WebPagesManager::update_web_page_instant_view_load_requests(WebPageId web_page_id, bool force_update, Result r_web_page_id) { - if (G()->close_flag()) { + if (G()->close_flag() && r_web_page_id.is_ok()) { r_web_page_id = Global::request_aborted_error(); } LOG(INFO) << "Update load requests for " << web_page_id;