summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-12-06 11:48:36 +0100
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2016-12-12 09:05:23 -0500
commite9f101a52f626744991ee73c3ced9c48bc013a51 (patch)
tree2e2e36e3db3a58d5f81366bc12ce539189817044 /platform/ios
parenta32e62cb0f3a6d9654712ab93380b15db7b337aa (diff)
downloadqtlocation-mapboxgl-e9f101a52f626744991ee73c3ced9c48bc013a51.tar.gz
[ios, macos] handle duplicate layer error
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/src/MGLMapView.mm10
1 files changed, 7 insertions, 3 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 3c019d4726..fad3540139 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -5353,9 +5353,13 @@ void MGLFinishCustomStyleLayer(void *context)
{
NSAssert(identifier, @"Style layer needs an identifier");
MGLCustomStyleLayerHandlers *context = new MGLCustomStyleLayerHandlers(preparation, drawing, completion);
- _mbglMap->addLayer(std::make_unique<mbgl::style::CustomLayer>(identifier.UTF8String, MGLPrepareCustomStyleLayer,
- MGLDrawCustomStyleLayer, MGLFinishCustomStyleLayer, context),
- otherIdentifier ? mbgl::optional<std::string>(otherIdentifier.UTF8String) : mbgl::optional<std::string>());
+ try {
+ _mbglMap->addLayer(std::make_unique<mbgl::style::CustomLayer>(identifier.UTF8String, MGLPrepareCustomStyleLayer,
+ MGLDrawCustomStyleLayer, MGLFinishCustomStyleLayer, context),
+ otherIdentifier ? mbgl::optional<std::string>(otherIdentifier.UTF8String) : mbgl::optional<std::string>());
+ } catch (std::runtime_error & err) {
+ [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()];
+ }
}
- (void)removeCustomStyleLayerWithIdentifier:(NSString *)identifier