2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 15:35:51 +00:00

Fix possible crash in quick replies.

This commit is contained in:
John Preston
2025-06-27 21:29:17 +04:00
parent fbfdef8f9a
commit 6a3989488e

View File

@@ -3704,7 +3704,9 @@ bool HistoryItem::isEmpty() const {
} }
Data::SavedSublist *HistoryItem::savedSublist() const { Data::SavedSublist *HistoryItem::savedSublist() const {
if (const auto saved = Get<HistoryMessageSaved>()) { if (isBusinessShortcut()) {
return nullptr;
} else if (const auto saved = Get<HistoryMessageSaved>()) {
if (saved->savedMessagesSublist) { if (saved->savedMessagesSublist) {
return saved->savedMessagesSublist; return saved->savedMessagesSublist;
} else if (const auto monoforum = _history->peer->monoforum()) { } else if (const auto monoforum = _history->peer->monoforum()) {
@@ -3928,9 +3930,10 @@ void HistoryItem::createComponents(CreateConfig &&config) {
mask |= HistoryMessageReplyMarkup::Bit(); mask |= HistoryMessageReplyMarkup::Bit();
} }
const auto requiresMonoforumPeer = _history->peer->amMonoforumAdmin(); const auto requiresMonoforumPeer = _history->peer->amMonoforumAdmin();
if (_history->peer->isSelf() if (!isBusinessShortcut()
&& (_history->peer->isSelf()
|| config.savedSublistPeer || config.savedSublistPeer
|| requiresMonoforumPeer) { || requiresMonoforumPeer)) {
mask |= HistoryMessageSaved::Bit(); mask |= HistoryMessageSaved::Bit();
} }
if (!config.restrictions.empty()) { if (!config.restrictions.empty()) {
@@ -4724,7 +4727,8 @@ void HistoryItem::createServiceFromMtp(const MTPDmessageService &message) {
? peerFromMTP(*message.vsaved_peer_id()) ? peerFromMTP(*message.vsaved_peer_id())
: PeerId(); : PeerId();
const auto requiresMonoforumPeer = _history->peer->amMonoforumAdmin(); const auto requiresMonoforumPeer = _history->peer->amMonoforumAdmin();
if (savedSublistPeer || requiresMonoforumPeer) { if (!isBusinessShortcut()
&& (savedSublistPeer || requiresMonoforumPeer)) {
AddComponents(HistoryMessageSaved::Bit()); AddComponents(HistoryMessageSaved::Bit());
const auto saved = Get<HistoryMessageSaved>(); const auto saved = Get<HistoryMessageSaved>();
saved->sublistPeerId = savedSublistPeer saved->sublistPeerId = savedSublistPeer