mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Fix potential negative loop bound.
QTorrentHandle::num_files() could return -1 in these cases.
This commit is contained in:
@@ -732,8 +732,8 @@ void QTorrentHandle::prioritize_first_last_piece(bool b) const
|
||||
{
|
||||
if (!has_metadata()) return;
|
||||
// Download first and last pieces first for all media files in the torrent
|
||||
const uint nbfiles = num_files();
|
||||
for (uint index = 0; index < nbfiles; ++index) {
|
||||
const int nbfiles = num_files();
|
||||
for (int index = 0; index < nbfiles; ++index) {
|
||||
const QString path = filepath_at(index);
|
||||
const QString ext = fsutils::fileExtension(path);
|
||||
if (misc::isPreviewable(ext) && torrent_handle::file_priority(index) > 0) {
|
||||
|
||||
@@ -60,8 +60,8 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent)
|
||||
// Fill list in
|
||||
std::vector<libtorrent::size_type> fp;
|
||||
h.file_progress(fp);
|
||||
unsigned int nbFiles = h.num_files();
|
||||
for (unsigned int i=0; i<nbFiles; ++i) {
|
||||
int nbFiles = h.num_files();
|
||||
for (int i=0; i<nbFiles; ++i) {
|
||||
QString fileName = h.filename_at(i);
|
||||
if (fileName.endsWith(".!qB"))
|
||||
fileName.chop(4);
|
||||
|
||||
Reference in New Issue
Block a user