mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix crash on invalid data in local cache.
This commit is contained in:
parent
276fe2169a
commit
39a02e649d
1 changed files with 8 additions and 5 deletions
|
@ -150,14 +150,17 @@ DocumentData *Document::readFromStreamHelper(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto storage = std::get_if<StorageFileLocation>(
|
|
||||||
&thumb->file().data);
|
|
||||||
if ((stream.status() != QDataStream::Ok)
|
if ((stream.status() != QDataStream::Ok)
|
||||||
|| (!dc && !access)
|
|| (!dc && !access)
|
||||||
|| !thumb
|
|| !thumb
|
||||||
|| !videoThumb
|
|| !videoThumb) {
|
||||||
|| (thumb->valid()
|
stream.setStatus(QDataStream::ReadCorruptData);
|
||||||
&& (!storage || !storage->isDocumentThumbnail()))) {
|
return nullptr;
|
||||||
|
}
|
||||||
|
const auto storage = std::get_if<StorageFileLocation>(
|
||||||
|
&thumb->file().data);
|
||||||
|
if (thumb->valid()
|
||||||
|
&& (!storage || !storage->isDocumentThumbnail())) {
|
||||||
stream.setStatus(QDataStream::ReadCorruptData);
|
stream.setStatus(QDataStream::ReadCorruptData);
|
||||||
// We can't convert legacy thumbnail location to modern, because
|
// We can't convert legacy thumbnail location to modern, because
|
||||||
// size letter ('s' or 'm') is lost, it was not saved in legacy.
|
// size letter ('s' or 'm') is lost, it was not saved in legacy.
|
||||||
|
|
Loading…
Add table
Reference in a new issue