summaryrefslogtreecommitdiff
path: root/include/mbgl/style/conversion
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/conversion')
-rw-r--r--include/mbgl/style/conversion/data_driven_property_value.hpp8
-rw-r--r--include/mbgl/style/conversion/property_value.hpp8
2 files changed, 12 insertions, 4 deletions
diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp
index f1bd1bdbb7..59d197b216 100644
--- a/include/mbgl/style/conversion/data_driven_property_value.hpp
+++ b/include/mbgl/style/conversion/data_driven_property_value.hpp
@@ -47,13 +47,17 @@ struct Converter<DataDrivenPropertyValue<T>> {
return {};
} else if (!(*expression).isFeatureConstant() || !(*expression).isZoomConstant()) {
return { std::move(*expression) };
- } else {
+ } else if ((*expression).getExpression().getKind() == Kind::Literal) {
optional<T> constant = fromExpressionValue<T>(
- dynamic_cast<const Literal&>((*expression).getExpression()).getValue());
+ static_cast<const Literal&>((*expression).getExpression()).getValue());
if (!constant) {
return {};
}
return DataDrivenPropertyValue<T>(*constant);
+ } else {
+ assert(false);
+ error = { "expected a literal expression" };
+ return {};
}
}
diff --git a/include/mbgl/style/conversion/property_value.hpp b/include/mbgl/style/conversion/property_value.hpp
index db23074c5e..b03655a848 100644
--- a/include/mbgl/style/conversion/property_value.hpp
+++ b/include/mbgl/style/conversion/property_value.hpp
@@ -54,13 +54,17 @@ struct Converter<PropertyValue<T>> {
return {};
} else if (!(*expression).isZoomConstant()) {
return { std::move(*expression) };
- } else {
+ } else if ((*expression).getExpression().getKind() == Kind::Literal) {
optional<T> constant = fromExpressionValue<T>(
- dynamic_cast<const Literal&>((*expression).getExpression()).getValue());
+ static_cast<const Literal&>((*expression).getExpression()).getValue());
if (!constant) {
return {};
}
return PropertyValue<T>(*constant);
+ } else {
+ assert(false);
+ error = { "expected a literal expression" };
+ return {};
}
}
};