[nightcolor] Fix division by zero

Summary:
If qAbs(targetTemp - m_currentTemp) is less than TEMPERATURE_STEP, then
it will result in a division by zero.

FIXED-IN: 5.17.5
BUG: 415359

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26493
icc-effect-5.17.5
Vlad Zahorodnii 2020-01-07 15:16:05 +02:00
parent 92817c5ac6
commit 5646c781c8
1 changed files with 1 additions and 1 deletions

View File

@ -408,7 +408,7 @@ void Manager::resetSlowUpdateTimer()
}
// calculate interval such as temperature is changed by TEMPERATURE_STEP K per timer timeout
int interval = availTime / (qAbs(targetTemp - m_currentTemp) / TEMPERATURE_STEP);
int interval = availTime * TEMPERATURE_STEP / qAbs(targetTemp - m_currentTemp);
if (interval == 0) {
interval = 1;
}