diff options
Diffstat (limited to 'platform/darwin/src/MGLBaseStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLBaseStyleLayer.mm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLBaseStyleLayer.mm b/platform/darwin/src/MGLBaseStyleLayer.mm index c567ce33d8..6e13bd29fd 100644 --- a/platform/darwin/src/MGLBaseStyleLayer.mm +++ b/platform/darwin/src/MGLBaseStyleLayer.mm @@ -1,5 +1,6 @@ #import "MGLBaseStyleLayer.h" +#import "MGLBaseStyleLayer_Private.hpp" #import "MGLStyleLayer_Private.hpp" #import "MGLMapView_Private.hpp" @@ -16,7 +17,10 @@ - (void)update { - self.mapView.mbglMap->update(mbgl::Update::RecalculateStyle | mbgl::Update::Classes); + // A style layer's map view can be nil when first created at runtime + // before being added to a map style. In these cases, just no-op since + // the addition of the layer will trigger a visual refresh. + if (self.mapView) self.mapView.mbglMap->update(mbgl::Update::RecalculateStyle | mbgl::Update::Classes); } - (void)setVisible:(BOOL)visible |