diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 4c1e20c7..0d51f33f 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2512,11 +2512,16 @@ bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *c } } +void has_message_content_web_page(const MessageContent *content) { + if (content->get_type() == MessageContentType::Text) { + return static_cast(content)->web_page_id.is_valid(); + } + return false; +} + void remove_message_content_web_page(MessageContent *content) { CHECK(content->get_type() == MessageContentType::Text); - auto &web_page_id = static_cast(content)->web_page_id; - CHECK(web_page_id.is_valid()); - web_page_id = WebPageId(); + static_cast(content)->web_page_id = WebPageId(); } void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id, diff --git a/td/telegram/MessageContent.h b/td/telegram/MessageContent.h index 4c679f81..2980e6c6 100644 --- a/td/telegram/MessageContent.h +++ b/td/telegram/MessageContent.h @@ -135,6 +135,8 @@ bool get_message_content_poll_is_closed(const Td *td, const MessageContent *cont bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content); +void has_message_content_web_page(const MessageContent *content); + void remove_message_content_web_page(MessageContent *content); void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id, diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index c43ed61f..752a3969 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -12021,6 +12021,7 @@ void MessagesManager::delete_pending_message_web_page(FullMessageId full_message CHECK(m != nullptr); MessageContent *content = m->content.get(); + CHECK(has_message_content_web_page(content)); unregister_message_content(td_, content, full_message_id, "delete_pending_message_web_page"); remove_message_content_web_page(content); register_message_content(td_, content, full_message_id, "delete_pending_message_web_page");