diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-01-17 22:12:52 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-18 10:38:31 -0800 |
commit | 344cd173ea96b2812549b980d1ab725c0aae57f0 (patch) | |
tree | 683b9943132731be238147b5def64a07f96c95c1 | |
parent | e38216d25444fd426921c372898c425d6030355e (diff) | |
download | qtlocation-mapboxgl-344cd173ea96b2812549b980d1ab725c0aae57f0.tar.gz |
[macos] Avoid nilling out style URL on load
-awakeFromNib nils out the styleURL property to ensure a style is always present on load. However, if the style URL is specified in the Style URL inspectable, it is set somewhere between -initWithCoder: and -awakeFromNib; nilling out the styleURL property in -awakeFromNib thus resets the style to the default. This change guards against nilling out a non-nil style URL, ensuring that -setStyleURL: is called once and only once on launch.
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 00fb5e3b23..3deb7db577 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -231,7 +231,11 @@ public: - (void)awakeFromNib { [super awakeFromNib]; - self.styleURL = nil; + // If the Style URL inspectable was not set, make sure to go through + // -setStyleURL: to load the default style. + if (_mbglMap->getStyleURL().empty()) { + self.styleURL = nil; + } } + (NSArray *)restorableStateKeyPaths { |