diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2016-11-15 10:05:35 -0800 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2016-11-15 11:37:35 -0800 |
commit | 9d5edb41ad5a2ed15a5f0344e5772488aac883eb (patch) | |
tree | bb78aebce16772eaada6acb5f936e6b93fd4c3cc | |
parent | eefda0d3813237d3f333c83780d481bc8a104309 (diff) | |
download | qtlocation-mapboxgl-9d5edb41ad5a2ed15a5f0344e5772488aac883eb.tar.gz |
[ios, macos] refs #7060: properly check removed layers & sources (#7062)
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 2da18bf95b..980abe3e3d 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -168,6 +168,12 @@ static NSURL *MGLStyleURL_emerald; - (void)removeLayer:(MGLStyleLayer *)layer { + if (!layer.rawLayer) { + [NSException raise:NSInvalidArgumentException format: + @"The style layer %@ cannot be removed from the style. " + @"Make sure the style layer was created as a member of a concrete subclass of MGLStyleLayer.", + layer]; + } [layer removeFromMapView:self.mapView]; } @@ -198,7 +204,6 @@ static NSURL *MGLStyleURL_emerald; @"Make sure otherLayer was obtained using -[MGLStyle layerWithIdentifier:].", otherLayer]; } - [layer addToMapView:self.mapView belowLayer:otherLayer]; } @@ -210,12 +215,17 @@ static NSURL *MGLStyleURL_emerald; @"Make sure the source was created as a member of a concrete subclass of MGLSource.", source]; } - [source addToMapView:self.mapView]; } - (void)removeSource:(MGLSource *)source { + if (!source.rawSource) { + [NSException raise:NSInvalidArgumentException format: + @"The source %@ cannot be removed from the style. " + @"Make sure the source was created as a member of a concrete subclass of MGLSource.", + source]; + } [source removeFromMapView:self.mapView]; } |