Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

fixes #1907: skip MGLPolyline/MGLPolygons with zero points #2098

Merged
merged 1 commit into from
Aug 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixes #1907: skip MGLPolyline/MGLPolygons with zero points
incanus committed Aug 17, 2015

Verified

This commit was signed with the committer’s verified signature. The key has expired.
vespian Paweł Rozlach
commit d3160ca4dbd561f45677d12598aafe2f1781ba72
6 changes: 4 additions & 2 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
@@ -1828,6 +1828,10 @@ - (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations

if ([annotation isKindOfClass:[MGLMultiPoint class]])
{
NSUInteger count = [(MGLMultiPoint *)annotation pointCount];

if (count == 0) break;

CGFloat alpha = (delegateImplementsAlphaForShape ?
[self.delegate mapView:self alphaForShapeAnnotation:annotation] :
1.0);
@@ -1881,8 +1885,6 @@ - (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations
userInfo:nil] raise];
}

NSUInteger count = [(MGLMultiPoint *)annotation pointCount];

CLLocationCoordinate2D *coordinates = (CLLocationCoordinate2D *)malloc(count * sizeof(CLLocationCoordinate2D));
[(MGLMultiPoint *)annotation getCoordinates:coordinates range:NSMakeRange(0, count)];