Fix crash in reading StorageFileLocation.

This commit is contained in:
John Preston 2021-04-10 06:58:10 +04:00
parent 4625e7613b
commit 16f1875fdc

View file

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