[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)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user