diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-06-29 11:47:03 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-06-29 12:14:51 -0700 |
commit | ca5b36ba80312766b694dabb32f8788125bff8ae (patch) | |
tree | b67477c6ad2be6cc89757c490af70a203a82ce81 /src | |
parent | 789baf4c1f252071bf58e689e050b34eb2656363 (diff) | |
download | qtlocation-mapboxgl-ca5b36ba80312766b694dabb32f8788125bff8ae.tar.gz |
[core] fix crash when trying to parse legacy filters
Legacy filters aren't part of the style specification, but you can generate them by parsing a legacy filter in a stylesheet, and obtaining the parsed Filter and serializing it.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/expression/is_constant.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mbgl/style/expression/is_constant.cpp b/src/mbgl/style/expression/is_constant.cpp index 0ebb37faa9..577ecf8cb6 100644 --- a/src/mbgl/style/expression/is_constant.cpp +++ b/src/mbgl/style/expression/is_constant.cpp @@ -4,6 +4,8 @@ namespace mbgl { namespace style { namespace expression { +constexpr static const char filter[] = "filter-"; + bool isFeatureConstant(const Expression& expression) { if (auto e = dynamic_cast<const CompoundExpressionBase*>(&expression)) { const std::string name = e->getName(); @@ -12,6 +14,9 @@ bool isFeatureConstant(const Expression& expression) { return false; } else if (name == "has" && parameterCount && *parameterCount == 1) { return false; + } else if (std::equal(std::begin(filter), std::end(filter) - 1, name.begin())) { + // Legacy filters begin with "filter-" and are never constant. + return false; } else if ( name == "properties" || name == "geometry-type" || |