Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Fix sanitizer error
Browse files Browse the repository at this point in the history
  • Loading branch information
zmiao committed Feb 26, 2020
1 parent 3c0e5a0 commit 2d3d22f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mbgl/style/expression/within.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ class PolygonFeature : public GeometryTileFeature {
public:
const Feature& feature;
mutable optional<GeometryCollection> geometry;
FeatureType type;

PolygonFeature(const Feature& feature_, const CanonicalTileID& canonical) : feature(feature_) {
if (getType() == FeatureType::Polygon) {
type = apply_visitor(ToFeatureType(), feature.geometry);
if (type == FeatureType::Polygon) {
geometry = convertGeometry(feature.geometry, canonical);
assert(geometry);
geometry = fixupPolygons(*geometry);
Expand All @@ -30,7 +32,7 @@ class PolygonFeature : public GeometryTileFeature {
}
}

FeatureType getType() const override { return apply_visitor(ToFeatureType(), feature.geometry); }
FeatureType getType() const override { return type; }
const PropertyMap& getProperties() const override { return feature.properties; }
FeatureIdentifier getID() const override { return feature.id; }
optional<mbgl::Value> getValue(const std::string& /*key*/) const override { return optional<mbgl::Value>(); }
Expand Down Expand Up @@ -208,7 +210,7 @@ ParseResult Within::parse(const Convertible& value, ParsingContext& ctx) {
return ParseResult();
},
[&ctx](const auto&) {
ctx.error("within' expression requires valid geojson source that contains polygon geometry type.");
ctx.error("'within' expression requires valid geojson source that contains polygon geometry type.");
return ParseResult();
});
}
Expand Down

0 comments on commit 2d3d22f

Please sign in to comment.