2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fix file references for faved stickers.

This commit is contained in:
John Preston
2018-08-28 14:32:27 +03:00
parent 018abd6aad
commit 51092fb6a9
5 changed files with 33 additions and 11 deletions

View File

@@ -1408,6 +1408,8 @@ StorageImage *getImage(const StorageImageLocation &location, int32 size) {
StorageImages::const_iterator i = storageImages.constFind(key);
if (i == storageImages.cend()) {
i = storageImages.insert(key, new StorageImage(location, size));
} else {
i.value()->refreshFileReference(location.fileReference());
}
return i.value();
}
@@ -1418,11 +1420,14 @@ StorageImage *getImage(const StorageImageLocation &location, const QByteArray &b
if (i == storageImages.cend()) {
QByteArray bytesArr(bytes);
i = storageImages.insert(key, new StorageImage(location, bytesArr));
} else if (!i.value()->loaded()) {
QByteArray bytesArr(bytes);
i.value()->setData(bytesArr);
if (!location.isNull()) {
Local::writeImage(key, StorageImageSaved(bytes));
} else {
i.value()->refreshFileReference(location.fileReference());
if (!i.value()->loaded()) {
QByteArray bytesArr(bytes);
i.value()->setData(bytesArr);
if (!location.isNull()) {
Local::writeImage(key, StorageImageSaved(bytes));
}
}
}
return i.value();