summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-09-11 13:21:14 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-09-13 13:58:20 -0700
commitb8425b51eb71a9a1374209b63019121b40884a90 (patch)
tree862675731dab7f78b19a8e174ab7f78f5508d916
parent041bd3cdad1304e608e1eefe86d637b3acaaa9d4 (diff)
downloadqtlocation-mapboxgl-b8425b51eb71a9a1374209b63019121b40884a90.tar.gz
[core] to-color should be idempotent
Ports https://github.com/mapbox/mapbox-gl-js/pull/7260.
-rw-r--r--src/mbgl/style/expression/coercion.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mbgl/style/expression/coercion.cpp b/src/mbgl/style/expression/coercion.cpp
index 486658ddda..2481444dc4 100644
--- a/src/mbgl/style/expression/coercion.cpp
+++ b/src/mbgl/style/expression/coercion.cpp
@@ -30,6 +30,9 @@ EvaluationResult toNumber(const Value& v) {
EvaluationResult toColor(const Value& colorValue) {
return colorValue.match(
+ [&](const Color& color) -> EvaluationResult {
+ return color;
+ },
[&](const std::string& colorString) -> EvaluationResult {
const optional<Color> result = Color::parse(colorString);
if (result) {