Add content checks after dup_message_content.

GitOrigin-RevId: cba1a103b02381490561213391e95f0e4aa08d64
This commit is contained in:
levlam 2020-01-15 01:45:59 +03:00
parent fa31f168b5
commit 4317cc3ef5
2 changed files with 7 additions and 1 deletions

View File

@ -3845,7 +3845,7 @@ removeFavoriteSticker sticker:InputFile = Ok;
//@description Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object @sticker Sticker file identifier
getStickerEmojis sticker:InputFile = Emojis;
//@description Searches for emojis by keywords. Supported only if the file database is enabled @text Text to search for @exact_match True, if only emojis, which exactly match text needs to be returned @input_language_code IETF language tag of the user's input language; can be empty if unknown
//@description Searches for emojis by keywords. Supported only if the file database is enabled @text Text to search for @exact_match True, if only emojis, which exactly match text needs to be returned @input_language_code IETF language tag of the user's input language; may be empty if unknown
searchEmojis text:string exact_match:Bool input_language_code:string = Emojis;
//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation @language_code Language code for which the emoji replacements will be suggested

View File

@ -17654,6 +17654,7 @@ MessagesManager::Message *MessagesManager::get_message_to_send(
bool *need_update_dialog_pos, unique_ptr<MessageForwardInfo> forward_info, bool is_copy) {
CHECK(d != nullptr);
CHECK(!reply_to_message_id.is_scheduled());
CHECK(content != nullptr);
bool is_scheduled = options.schedule_date != 0;
DialogId dialog_id = d->dialog_id;
@ -19734,6 +19735,7 @@ void MessagesManager::edit_message_media(FullMessageId full_message_id,
cancel_edit_message_media(dialog_id, m, "Cancelled by new editMessageMedia request");
m->edited_content = dup_message_content(td_, dialog_id, content.content.get(), false);
CHECK(m->edited_content != nullptr);
m->edited_reply_markup = r_new_reply_markup.move_as_ok();
m->edit_generation = ++current_message_edit_generation_;
m->edit_promise = std::move(promise);
@ -29179,6 +29181,9 @@ void MessagesManager::update_top_dialogs(DialogId dialog_id, const Message *m) {
MessagesManager::Message *MessagesManager::continue_send_message(DialogId dialog_id, unique_ptr<Message> &&m,
uint64 logevent_id) {
CHECK(logevent_id != 0);
CHECK(m != nullptr);
CHECK(m->content != nullptr);
Dialog *d = get_dialog_force(dialog_id);
if (d == nullptr) {
LOG(ERROR) << "Can't find " << dialog_id << " to resend a message";
@ -29416,6 +29421,7 @@ void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
m->date = now;
}
m->content = dup_message_content(td_, to_dialog_id, m->content.get(), true);
CHECK(m->content != nullptr);
m->have_previous = true;
m->have_next = true;