Make TorrentInfo immutable

This commit is contained in:
Vladimir Golovnev (Glassez)
2021-12-09 13:05:49 +03:00
parent 9d2bb67834
commit 62b50d1475
22 changed files with 382 additions and 255 deletions

View File

@@ -594,9 +594,12 @@ void TorrentsController::pieceHashesAction()
throw APIError(APIErrorType::NotFound);
QJsonArray pieceHashes;
const QVector<QByteArray> hashes = torrent->info().pieceHashes();
for (const QByteArray &hash : hashes)
pieceHashes.append(QString(hash.toHex()));
if (torrent->hasMetadata())
{
const QVector<QByteArray> hashes = torrent->info().pieceHashes();
for (const QByteArray &hash : hashes)
pieceHashes.append(QString(hash.toHex()));
}
setResult(pieceHashes);
}