Fix crash in sticker set parsing.

This commit is contained in:
John Preston 2020-05-30 22:24:35 +04:00
parent aaa4db7b27
commit 4695ebae6e
1 changed files with 8 additions and 5 deletions

View File

@ -973,16 +973,19 @@ Set *FeedSetFull(const MTPmessages_StickerSet &data) {
const auto &s = d.vset().c_stickerSet(); const auto &s = d.vset().c_stickerSet();
auto &sets = Auth().data().stickerSetsRef(); auto &sets = Auth().data().stickerSetsRef();
auto it = sets.find(s.vid().v); const auto wasArchived = [&] {
const auto wasArchived = (it->second->flags & MTPDstickerSet::Flag::f_archived); auto it = sets.find(s.vid().v);
return (it != sets.end())
&& (it->second->flags & MTPDstickerSet::Flag::f_archived);
}();
auto set = FeedSet(s); auto set = FeedSet(s);
set->flags &= ~MTPDstickerSet_ClientFlag::f_not_loaded; set->flags &= ~MTPDstickerSet_ClientFlag::f_not_loaded;
auto &d_docs = d.vdocuments().v; const auto &d_docs = d.vdocuments().v;
auto customIt = sets.find(Stickers::CustomSetId); auto customIt = sets.find(Stickers::CustomSetId);
auto inputSet = MTP_inputStickerSetID( const auto inputSet = MTP_inputStickerSetID(
MTP_long(set->id), MTP_long(set->id),
MTP_long(set->access)); MTP_long(set->access));
@ -1055,7 +1058,7 @@ Set *FeedSetFull(const MTPmessages_StickerSet &data) {
} }
if (set) { if (set) {
const auto isArchived = (set->flags & MTPDstickerSet::Flag::f_archived); const auto isArchived = !!(set->flags & MTPDstickerSet::Flag::f_archived);
if (set->flags & MTPDstickerSet::Flag::f_installed_date) { if (set->flags & MTPDstickerSet::Flag::f_installed_date) {
if (!isArchived) { if (!isArchived) {
Local::writeInstalledStickers(); Local::writeInstalledStickers();