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 15:55:34 -0700
commitc044dd88b22ca081a7256fe663acf7e3ebf284d8 (patch)
tree643330548e426ea34f7e2ad531449485c710d926
parentdf93047d405d17f86d54c6784e3664436085deb3 (diff)
downloadqtlocation-mapboxgl-c044dd88b22ca081a7256fe663acf7e3ebf284d8.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) {