1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix division by 0 when receiving from empty files

Like /dev/zero.
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-08-28 19:21:48 +02:00
parent af9c370169
commit 74e9d7a4f5

View File

@ -171,10 +171,15 @@ void FileTransfertWidget::onFileTransferInfo(int FriendId, int FileNum, int64_t
etaTime = etaTime.addSecs(etaSecs);
eta->setText(etaTime.toString("mm:ss"));
if (!Filesize)
{
progress->setValue(0);
qDebug() << QString("FT: received %1 bytes of an empty file, stop sending sequential devices, zetok!").arg(BytesSent);
}
else
{
progress->setValue(BytesSent*100/Filesize);
qDebug() << QString("FT: received %1/%2 bytes, progress is %3%").arg(BytesSent).arg(Filesize).arg(BytesSent*100/Filesize);
qDebug() << QString("FT: received %1/%2 bytes, progress is %3%").arg(BytesSent).arg(Filesize).arg(BytesSent*100/Filesize);
}
lastUpdate = newtime;
lastBytesSent = BytesSent;
}