Don't request settings of unknown peers.

This commit is contained in:
John Preston 2023-02-06 12:24:08 +04:00
parent af8c1f77c7
commit 405230c0c6
1 changed files with 23 additions and 0 deletions

View File

@ -1727,6 +1727,29 @@ void ApiWrap::leaveChannel(not_null<ChannelData*> channel) {
}
void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) {
const auto bad = peer.match([](const MTPDinputNotifyUsers &) {
return false;
}, [](const MTPDinputNotifyChats &) {
return false;
}, [](const MTPDinputNotifyBroadcasts &) {
return false;
}, [&](const MTPDinputNotifyPeer &data) {
if (data.vpeer().type() == mtpc_inputPeerEmpty) {
LOG(("Api Error: Requesting settings for empty peer."));
return true;
}
return false;
}, [&](const MTPDinputNotifyForumTopic &data) {
if (data.vpeer().type() == mtpc_inputPeerEmpty) {
LOG(("Api Error: Requesting settings for empty peer topic."));
return true;
}
return false;
});
if (bad) {
return;
}
const auto peerFromInput = [&](const MTPInputPeer &inputPeer) {
return inputPeer.match([&](const MTPDinputPeerSelf &) {
return _session->userPeerId();