mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-11 17:47:06 +00:00
Fix crash in faving stickers.
Don't fill dates in any sets except CloudRecentSetId. Otherwise some assertions will be violated later.
This commit is contained in:
parent
f98fdeab3f
commit
321f5d879d
@ -465,20 +465,23 @@ void SpecialSetReceived(
|
|||||||
|
|
||||||
auto dates = std::vector<TimeId>();
|
auto dates = std::vector<TimeId>();
|
||||||
auto dateIndex = 0;
|
auto dateIndex = 0;
|
||||||
auto datesAvailable = (items.size() == usageDates.size());
|
auto datesAvailable = (items.size() == usageDates.size())
|
||||||
|
&& (setId == CloudRecentSetId);
|
||||||
|
|
||||||
auto custom = sets.find(CustomSetId);
|
auto custom = sets.find(CustomSetId);
|
||||||
auto pack = Pack();
|
auto pack = Pack();
|
||||||
pack.reserve(items.size());
|
pack.reserve(items.size());
|
||||||
for_const (auto &mtpDocument, items) {
|
for_const (auto &mtpDocument, items) {
|
||||||
const auto date = datesAvailable
|
++dateIndex;
|
||||||
? TimeId(usageDates[dateIndex++].v)
|
|
||||||
: TimeId();
|
|
||||||
auto document = Auth().data().document(mtpDocument);
|
auto document = Auth().data().document(mtpDocument);
|
||||||
if (!document->sticker()) continue;
|
if (!document->sticker()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
pack.push_back(document);
|
pack.push_back(document);
|
||||||
dates.push_back(date);
|
if (datesAvailable) {
|
||||||
|
dates.push_back(TimeId(usageDates[dateIndex - 1].v));
|
||||||
|
}
|
||||||
if (custom != sets.cend()) {
|
if (custom != sets.cend()) {
|
||||||
auto index = custom->stickers.indexOf(document);
|
auto index = custom->stickers.indexOf(document);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -3458,7 +3458,9 @@ void _readStickerSets(FileKey &stickersKey, Stickers::Order *outOrder = nullptr,
|
|||||||
for (auto i = 0; i != datesCount; ++i) {
|
for (auto i = 0; i != datesCount; ++i) {
|
||||||
auto date = qint32();
|
auto date = qint32();
|
||||||
stickers.stream >> date;
|
stickers.stream >> date;
|
||||||
set.dates.push_back(TimeId(date));
|
if (set.id == Stickers::CloudRecentSetId) {
|
||||||
|
set.dates.push_back(TimeId(date));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user