aboutsummaryrefslogtreecommitdiff
path: root/src/qt/modaloverlay.cpp
diff options
context:
space:
mode:
authorHiLivin <magicjakub@gmail.com>2021-12-14 00:35:50 +0100
committerHiLivin <magicjakub@gmail.com>2021-12-14 19:40:39 +0100
commit71d33380ed6858b4a65b396332bfb22d984642a6 (patch)
tree52ed8ddea988f202cc79687369d93824f297832e /src/qt/modaloverlay.cpp
parent5dd28e5cff8a8177b969181ecb58d045e7f80a72 (diff)
qt: prevent negative values of progressPerHour
Added a similar guard to progressPerHour as is placed at remainingMSecs. It prevents the display of negative values like "-0.00%" in some cases.
Diffstat (limited to 'src/qt/modaloverlay.cpp')
-rw-r--r--src/qt/modaloverlay.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index ae27cad477..cca77881e1 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -108,7 +108,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i == blockProcessTime.size() - 1) {
progressDelta = blockProcessTime[0].second - sample.second;
timeDelta = blockProcessTime[0].first - sample.first;
- progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600;
+ progressPerHour = (progressDelta > 0) ? progressDelta / (double)timeDelta * 1000 * 3600 : 0;
remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
break;
}