summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-10-05 13:06:28 -0400
committerGitHub <noreply@github.com>2019-10-05 13:06:28 -0400
commita90e5f6e97232e9e42ee86df9b07365223528b91 (patch)
tree6226b72e7fef7f6050499f872dbf3cb4253025ea /platform
parent5c565a5e51be8379ddc2ffb5c859d8cfebe2fcd5 (diff)
downloadqtlocation-mapboxgl-a90e5f6e97232e9e42ee86df9b07365223528b91.tar.gz
[ios, macos] Changed exception to assert and nil return, since attribution methods can be called via user interaction (without a mechanism to try/catch) (#15764)
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/src/MGLImageSource.mm7
-rw-r--r--platform/darwin/src/MGLRasterTileSource.mm7
-rw-r--r--platform/darwin/src/MGLVectorTileSource.mm7
3 files changed, 18 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLImageSource.mm b/platform/darwin/src/MGLImageSource.mm
index 421cc7a155..2d2f090079 100644
--- a/platform/darwin/src/MGLImageSource.mm
+++ b/platform/darwin/src/MGLImageSource.mm
@@ -1,6 +1,7 @@
#import "MGLImageSource.h"
#import "MGLGeometry_Private.h"
+#import "MGLLoggingConfiguration_Private.h"
#import "MGLSource_Private.h"
#import "MGLTileSource_Private.h"
#import "NSURL+MGLAdditions.h"
@@ -99,7 +100,11 @@
}
- (NSString *)attributionHTMLString {
- MGLAssertStyleSourceIsValid();
+ if (!self.rawSource) {
+ MGLAssert(0, @"Source with identifier `%@` was invalidated after a style change", self.identifier);
+ return nil;
+ }
+
auto attribution = self.rawSource->getAttribution();
return attribution ? @(attribution->c_str()) : nil;
}
diff --git a/platform/darwin/src/MGLRasterTileSource.mm b/platform/darwin/src/MGLRasterTileSource.mm
index b31cee296f..80b21cc7dd 100644
--- a/platform/darwin/src/MGLRasterTileSource.mm
+++ b/platform/darwin/src/MGLRasterTileSource.mm
@@ -1,5 +1,6 @@
#import "MGLRasterTileSource_Private.h"
+#import "MGLLoggingConfiguration_Private.h"
#import "MGLMapView_Private.h"
#import "MGLSource_Private.h"
#import "MGLTileSource_Private.h"
@@ -72,7 +73,11 @@ static const CGFloat MGLRasterTileSourceRetinaTileSize = 512;
}
- (NSString *)attributionHTMLString {
- MGLAssertStyleSourceIsValid();
+ if (!self.rawSource) {
+ MGLAssert(0, @"Source with identifier `%@` was invalidated after a style change", self.identifier);
+ return nil;
+ }
+
auto attribution = self.rawSource->getAttribution();
return attribution ? @(attribution->c_str()) : nil;
}
diff --git a/platform/darwin/src/MGLVectorTileSource.mm b/platform/darwin/src/MGLVectorTileSource.mm
index 85270c4a49..9ab11e2e56 100644
--- a/platform/darwin/src/MGLVectorTileSource.mm
+++ b/platform/darwin/src/MGLVectorTileSource.mm
@@ -1,6 +1,7 @@
#import "MGLVectorTileSource_Private.h"
#import "MGLFeature_Private.h"
+#import "MGLLoggingConfiguration_Private.h"
#import "MGLSource_Private.h"
#import "MGLTileSource_Private.h"
#import "MGLStyle_Private.h"
@@ -44,7 +45,11 @@
}
- (NSString *)attributionHTMLString {
- MGLAssertStyleSourceIsValid();
+ if (!self.rawSource) {
+ MGLAssert(0, @"Source with identifier `%@` was invalidated after a style change", self.identifier);
+ return nil;
+ }
+
auto attribution = self.rawSource->getAttribution();
return attribution ? @(attribution->c_str()) : nil;
}