[core] Return null when removing nonexistent layer

In case of exception, silently ignore removal of nonexistent layer
and return nullptr
This commit is contained in:
Eimantas Vaiciunas
2017-02-07 08:33:08 +02:00
committed by Jesse Bounds
parent 6b0ad899b3
commit 76b3825360
3 changed files with 3 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Fixed an issue in which a vector style layer predicate involving the `$id` key path would exclude all features from the layer. ([#7989](https://github.com/mapbox/mapbox-gl-native/pull/7989), [#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
* Fixed an issue causing vector style layer predicates to be evaluated as if each feature had a `$type` attribute of 1, 2, or 3. The `$type` key path can now be compared to `Point`, `LineString`, or `Polygon`, as described in the documentation. ([#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
* When setting an `MGLShapeSource`’s shape to an `MGLFeature` instance, any `UIColor` attribute value is now converted to the equivalent CSS string representation for use with `MGLInterpolationModeIdentity` in style functions. ([#8025](https://github.com/mapbox/mapbox-gl-native/pull/8025))
* No exception is thrown when removing nonexistent layer from a style ([#7962](https://github.com/mapbox/mapbox-gl-native/pull/7962))
### User interaction

View File

@@ -25,6 +25,7 @@
* Fixed an issue in which a vector style layer predicate involving the `$id` key path would exclude all features from the layer. ([#7989](https://github.com/mapbox/mapbox-gl-native/pull/7989), [#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
* Fixed an issue causing vector style layer predicates to be evaluated as if each feature had a `$type` attribute of 1, 2, or 3. The `$type` key path can now be compared to `Point`, `LineString`, or `Polygon`, as described in the documentation. ([#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
* When setting an `MGLShapeSource`’s shape to an `MGLFeature` instance, any `NSColor` attribute value is now converted to the equivalent CSS string representation for use with `MGLInterpolationModeIdentity` in style functions. ([#8025](https://github.com/mapbox/mapbox-gl-native/pull/8025))
* No exception is thrown when removing nonexistent layer from a style ([#7962](https://github.com/mapbox/mapbox-gl-native/pull/7962))
### User interaction

View File

@@ -231,7 +231,7 @@ std::unique_ptr<Layer> Style::removeLayer(const std::string& id) {
});
if (it == layers.end())
throw std::runtime_error("no such layer");
return nullptr;
auto layer = std::move(*it);