[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.
This commit is contained in:
Minh Nguyễn
2017-01-17 22:12:52 -08:00
committed by Minh Nguyễn
parent e38216d254
commit 344cd173ea

View File

@@ -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 {