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-11 15:15:33 -0700
commitc3dfb141ba1bea8fdf47e1f3522853161cd7ade9 (patch)
tree6e89fbfc321e5fe396fdc44c8146089c8f906e7c
parentbc581012fd3e0ed5da057394d24aa6eac1989b49 (diff)
downloadqtlocation-mapboxgl-c3dfb141ba1bea8fdf47e1f3522853161cd7ade9.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) {