mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-27 17:13:40 +00:00
Fixed crash when bot removes message inline keyboard while editing.
This commit is contained in:
parent
5f12c6d85b
commit
1fe562ec13
@ -6978,18 +6978,39 @@ void HistoryMessage::setText(const QString &text, const EntitiesInText &entities
|
||||
}
|
||||
|
||||
void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
||||
if (!markup && !(_flags & MTPDmessage::Flag::f_reply_markup)) return;
|
||||
if (!markup) {
|
||||
if (_flags & MTPDmessage::Flag::f_reply_markup) {
|
||||
_flags &= ~MTPDmessage::Flag::f_reply_markup;
|
||||
if (Has<HistoryMessageReplyMarkup>()) {
|
||||
RemoveComponents(HistoryMessageReplyMarkup::Bit());
|
||||
}
|
||||
setPendingInitDimensions();
|
||||
Notify::replyMarkupUpdated(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// optimization: don't create markup component for the case
|
||||
// MTPDreplyKeyboardHide with flags = 0, assume it has f_zero flag
|
||||
if (markup->type() == mtpc_replyKeyboardHide && markup->c_replyKeyboardHide().vflags.v == 0) {
|
||||
bool changed = false;
|
||||
if (Has<HistoryMessageReplyMarkup>()) {
|
||||
RemoveComponents(HistoryMessageReplyMarkup::Bit());
|
||||
changed = true;
|
||||
}
|
||||
if (!(_flags & MTPDmessage::Flag::f_reply_markup)) {
|
||||
_flags |= MTPDmessage::Flag::f_reply_markup;
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
setPendingInitDimensions();
|
||||
|
||||
Notify::replyMarkupUpdated(this);
|
||||
}
|
||||
} else {
|
||||
if (!(_flags & MTPDmessage::Flag::f_reply_markup)) {
|
||||
_flags |= MTPDmessage::Flag::f_reply_markup;
|
||||
}
|
||||
if (!Has<HistoryMessageReplyMarkup>()) {
|
||||
AddComponents(HistoryMessageReplyMarkup::Bit());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user