Fix crash in reading StorageFileLocation.

This commit is contained in:
John Preston 2021-04-10 06:58:10 +04:00
parent 4625e7613b
commit 16f1875fdc
1 changed files with 8 additions and 4 deletions

View File

@ -376,10 +376,14 @@ std::optional<StorageFileLocation> StorageFileLocation::FromSerialized(
result._id = (result._type == Type::PeerPhoto)
? DeserializePeerId(id).value
: id;
result._localId = field1;
result._inMessagePeerId = (field2 > 0)
result._localId = (result._type == Type::PeerPhoto)
? 0
: field1;
result._inMessagePeerId = (field2 && result._type == Type::PeerPhoto)
? ((field2 > 0)
? peerFromUser(UserId(field2))
: peerFromChannel(ChannelId(-field2));
: peerFromChannel(ChannelId(-field2)))
: PeerId();
}
return (stream.status() == QDataStream::Ok && result.valid())