Fix crash on failed to send photo in media group.

GitOrigin-RevId: fb390f0f5f4d963529283bc5b6418bfdf477a4f0
This commit is contained in:
levlam 2019-04-03 03:12:19 +03:00
parent 47bbdabe5a
commit ad9ecdc3f0

View File

@ -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())); file_ids.push_back(get_message_content_file_id(m->content.get()));
random_ids.push_back(begin_send_message(dialog_id, m)); 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()); const FormattedText *caption = get_message_content_caption(m->content.get());
auto input_media = get_input_media(m->content.get(), td_, m->ttl, true); auto input_media = get_input_media(m->content.get(), td_, m->ttl, true);
if (input_media == nullptr) { CHECK(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;
}
auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group"); auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group");
int32 input_single_media_flags = 0; int32 input_single_media_flags = 0;
if (!entities.empty()) { 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<telegram_api::inputSingleMedia>( input_single_media.push_back(make_tl_object<telegram_api::inputSingleMedia>(
input_single_media_flags, std::move(input_media), random_ids.back(), caption == nullptr ? "" : caption->text, input_single_media_flags, std::move(input_media), random_ids.back(), caption == nullptr ? "" : caption->text,
std::move(entities))); std::move(entities)));
if (request.results[i].is_error()) {
success = false;
}
} }
if (!success) { if (!success) {