summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLLineStyleLayer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLLineStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index fc220650f4..80b1e907e6 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -119,14 +119,14 @@ namespace mbgl {
- (void)removeFromMapView:(MGLMapView *)mapView
{
+ if (self.rawLayer != mapView.mbglMap->getLayer(self.identifier.UTF8String)) {
+ return;
+ }
+
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
if (!removedLayer) {
return;
}
-
- auto originalLayer = std::make_unique<mbgl::style::LineLayer>(self.identifier.UTF8String, self.sourceIdentifier.UTF8String);
- _pendingLayer = std::move(originalLayer);
- self.rawLayer = _pendingLayer.get();
mbgl::style::LineLayer *layer = dynamic_cast<mbgl::style::LineLayer *>(removedLayer.get());
if (!layer) {