2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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:
John Preston
2018-03-08 12:57:05 +03:00
parent f98fdeab3f
commit 321f5d879d
2 changed files with 12 additions and 7 deletions

View File

@@ -465,20 +465,23 @@ void SpecialSetReceived(
auto dates = std::vector<TimeId>();
auto dateIndex = 0;
auto datesAvailable = (items.size() == usageDates.size());
auto datesAvailable = (items.size() == usageDates.size())
&& (setId == CloudRecentSetId);
auto custom = sets.find(CustomSetId);
auto pack = Pack();
pack.reserve(items.size());
for_const (auto &mtpDocument, items) {
const auto date = datesAvailable
? TimeId(usageDates[dateIndex++].v)
: TimeId();
++dateIndex;
auto document = Auth().data().document(mtpDocument);
if (!document->sticker()) continue;
if (!document->sticker()) {
continue;
}
pack.push_back(document);
dates.push_back(date);
if (datesAvailable) {
dates.push_back(TimeId(usageDates[dateIndex - 1].v));
}
if (custom != sets.cend()) {
auto index = custom->stickers.indexOf(document);
if (index >= 0) {