From 3fae108cb166ab83447dccd8187d549aa8d82cca Mon Sep 17 00:00:00 2001 From: Cyril Soler Date: Thu, 21 Apr 2016 12:58:48 -0400 Subject: [PATCH] removed div by zero in transfers dialog --- retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index 0a7b7cb45..ce0f7f908 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -942,7 +942,8 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo) qlonglong completed = fileInfo.transfered; qlonglong remaining = fileInfo.size - fileInfo.transfered; - qlonglong downloadtime = (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0); + + qlonglong downloadtime = (fileInfo.tfRate > 0)?( (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0) ) : 0 ; qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits::max(); if (qi64LastDL == 0) // file is complete, or any raison why the time has not been set properly @@ -1355,7 +1356,7 @@ void TransfersDialog::insertTransfers() qlonglong fileSize = info.size; qlonglong completed = pit->transfered; // double progress = (info.size > 0)?(pit->transfered * 100.0 / info.size):0.0; - qlonglong remaining = (info.size - pit->transfered) / (pit->tfRate * 1024.0); + qlonglong remaining = (pit->tfRate>0)?((info.size - pit->transfered) / (pit->tfRate * 1024.0)):0; // Estimate the completion. We need something more accurate, meaning that we need to // transmit the completion info.