Fix the conversion of a colour from a string.
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 20 Oct 2011 08:51:09 +0000 (10:51 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Apr 2012 10:47:58 +0000 (12:47 +0200)
Don't assume it's HSL just because it isn't RGB.

This error was found by GCC's set-but-unused warning.

Change-Id: Ie22e1509892163fccb3868fe8ff7091dc7bf5091
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
src/quick/items/context2d/qquickcontext2d.cpp

index edf0619..6d8d9b8 100644 (file)
@@ -184,7 +184,7 @@ QColor qt_color_from_string(v8::Local<v8::Value> name)
         if (*p != ')') return QColor();
         if (isRgb)
             return QColor::fromRgba(qRgba(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255)));
-        else
+        else if (isHsl)
             return QColor::fromHsl(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255));
     }
     return QColor();