From 334e818af089011da29fd0c401e68972c5cc9d40 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Thu, 13 Feb 2014 18:15:36 +0530 Subject: [PATCH] Do not show OSD for invalid values of percentage like -1 or 200 REVIEW: 115712 --- src/shell/osd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell/osd.cpp b/src/shell/osd.cpp index e94d22567..24382d729 100644 --- a/src/shell/osd.cpp +++ b/src/shell/osd.cpp @@ -98,7 +98,8 @@ void Osd::virtualDesktopChanged(const QString ¤tVirtualDesktopName) void Osd::showProgress(const QString &icon, const int percent, const QString &additionalText) { - m_osdObject->rootObject()->setProperty("osdValue", percent); + int value = qBound(0, percent, 100); + m_osdObject->rootObject()->setProperty("osdValue", value); m_osdObject->rootObject()->setProperty("osdAdditionalText", additionalText); m_osdObject->rootObject()->setProperty("showingProgress", true); m_osdObject->rootObject()->setProperty("icon", icon);