mirror of
https://invent.kde.org/plasma/plasma-desktop.git
synced 2026-11-03 22:59:45 -09:00
applets/taskmanager: Guard external input for progress
qRound(infinite) will assert, guard appropriately BUG: 513312
This commit is contained in:
parent
fcd4127fd3
commit
e13b07de49
1 changed files with 6 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
#include <KSharedConfig>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "log_settings.h"
|
||||
#include <settings.h>
|
||||
|
|
@ -209,7 +210,11 @@ void Backend::update(const QString &uri, const QMap<QString, QVariant> &properti
|
|||
if (foundProgress != propertiesEnd) {
|
||||
const int oldSanitizedProgress = progress(storageId);
|
||||
|
||||
foundEntry->progress = qRound(foundProgress->toDouble() * 100);
|
||||
double progressValue = foundProgress->toDouble();
|
||||
if (!std::isfinite(progressValue)) {
|
||||
progressValue = 0.0; // Treat NaN/Inf as zero
|
||||
}
|
||||
foundEntry->progress = qRound(progressValue * 100);
|
||||
|
||||
const int newSanitizedProgress = progress(storageId);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue