Browse Source

Merge pull request #6278 from Falcosc/fix_incompleate_file_crash

fix index overflow for torrents with invalid meta data or empty progress
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
043ae1eb17
  1. 5
      src/base/bittorrent/torrenthandle.cpp

5
src/base/bittorrent/torrenthandle.cpp

@ -1701,6 +1701,11 @@ void TorrentHandle::manageIncompleteFiles()
{ {
const bool isAppendExtensionEnabled = m_session->isAppendExtensionEnabled(); const bool isAppendExtensionEnabled = m_session->isAppendExtensionEnabled();
QVector<qreal> fp = filesProgress(); QVector<qreal> fp = filesProgress();
if( fp.size() != filesCount() ) {
qDebug() << "skip manageIncompleteFiles because of invalid torrent meta-data or empty file-progress";
return;
}
for (int i = 0; i < filesCount(); ++i) { for (int i = 0; i < filesCount(); ++i) {
QString name = filePath(i); QString name = filePath(i);
if (isAppendExtensionEnabled && (fileSize(i) > 0) && (fp[i] < 1)) { if (isAppendExtensionEnabled && (fileSize(i) > 0) && (fp[i] < 1)) {

Loading…
Cancel
Save