From e51d8ff8152a78d3a54d4ab7187f62c83da9ddb4 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Mon, 16 Mar 2026 09:23:11 +0100 Subject: [PATCH] fix(libsync): prevent Q_ASSERT(value < maximalPlusOne) failing. Signed-off-by: Camila Ayres --- src/libsync/progressdispatcher.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libsync/progressdispatcher.cpp b/src/libsync/progressdispatcher.cpp index e6e5a3e56fb2f..ad9616762b7f1 100644 --- a/src/libsync/progressdispatcher.cpp +++ b/src/libsync/progressdispatcher.cpp @@ -370,14 +370,17 @@ void ProgressInfo::recomputeCompletedSize() ProgressInfo::Estimates ProgressInfo::Progress::estimates() const { - Estimates est{}; - est.estimatedBandwidth = _progressPerSec; - if (_progressPerSec != 0) { - est.estimatedEta = qRound64(static_cast(_total - _completed) / _progressPerSec) * 1000; + Estimates estimation{}; + estimation.estimatedBandwidth = _progressPerSec; + if (const auto progress = _total - _completed; + _progressPerSec != 0 && progress > _progressPerSec) { + const auto progressinDouble = static_cast(progress); + const auto estimatedEta = progressinDouble / _progressPerSec; + estimation.estimatedEta = qRound64(estimatedEta) * 1000; } else { - est.estimatedEta = 0; // looks better than qint64 max + estimation.estimatedEta = 0; // looks better than qint64 max } - return est; + return estimation; } qint64 ProgressInfo::Progress::completed() const