From ad9ecdc3f0105b915b347d1dd949796e553a1d7f Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 3 Apr 2019 03:12:19 +0300 Subject: [PATCH] Fix crash on failed to send photo in media group. GitOrigin-RevId: fb390f0f5f4d963529283bc5b6418bfdf477a4f0 --- td/telegram/MessagesManager.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0319d26fc..bf5f8768f 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -16183,14 +16183,15 @@ void MessagesManager::do_send_message_group(int64 media_album_id) { file_ids.push_back(get_message_content_file_id(m->content.get())); random_ids.push_back(begin_send_message(dialog_id, m)); + + if (request.results[i].is_error()) { + success = false; + continue; + } + const FormattedText *caption = get_message_content_caption(m->content.get()); auto input_media = get_input_media(m->content.get(), td_, m->ttl, true); - if (input_media == nullptr) { - // TODO return CHECK - auto file_id = get_message_content_file_id(m->content.get()); - LOG(FATAL) << to_string(get_message_content_object(m->content.get(), td_, m->date, m->is_content_secret)) << " " - << to_string(td_->file_manager_->get_file_object(file_id)) << " " << m->ttl; - } + CHECK(input_media != nullptr); auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group"); int32 input_single_media_flags = 0; if (!entities.empty()) { @@ -16200,9 +16201,6 @@ void MessagesManager::do_send_message_group(int64 media_album_id) { input_single_media.push_back(make_tl_object( input_single_media_flags, std::move(input_media), random_ids.back(), caption == nullptr ? "" : caption->text, std::move(entities))); - if (request.results[i].is_error()) { - success = false; - } } if (!success) {