if (!fileQueue.first())
return;
- int filePercent = (read * 100) / total;
+ int filePercent = total ? (read * 100) / total : 100;
emit fileProgress(filePercent);
emit fileQueue.first()->progress(filePercent);
- int totalPercent = ((hashedFileSize + read) * 100) / totalFileSize;
+ int totalPercent = totalFileSize ? ((hashedFileSize + read) * 100) / totalFileSize : 100;
emit progress(totalPercent);
}
#endif
if (file.open(QIODevice::ReadOnly))
{
- while (!file.atEnd())
+ do
{
if (abort)
return;
QByteArray data = file.read(ED2K_PART_SIZE);
while (!(buffer->put(data, file.atEnd()) || abort));
- }
+ } while (!file.atEnd());
}
}