From ed697ca5b7a4b5ad78da49389b007d824e1ab8aa Mon Sep 17 00:00:00 2001 From: Sophally Yi Date: Tue, 29 Sep 2015 17:19:56 +0700 Subject: [PATCH] Fixed index out of bounds issue when built with XCode 7 --- REMarkerClusterer/REMarkerClusterer.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/REMarkerClusterer/REMarkerClusterer.m b/REMarkerClusterer/REMarkerClusterer.m index 82c7c75..c42e6cc 100755 --- a/REMarkerClusterer/REMarkerClusterer.m +++ b/REMarkerClusterer/REMarkerClusterer.m @@ -442,10 +442,12 @@ - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { [self clusterize:YES]; - [self.mapView deselectAnnotation:[self.mapView.selectedAnnotations objectAtIndex:0] animated:NO]; - - if ([_delegate respondsToSelector:@selector(mapView:regionDidChangeAnimated:)]) + if ([self.selectedAnnotations count]>0) { + [self.mapView deselectAnnotation:[self.mapView.selectedAnnotations objectAtIndex:0] animated:NO]; + if ([_delegate respondsToSelector:@selector(mapView:regionDidChangeAnimated:)]) [_delegate mapView:mapView regionDidChangeAnimated:animated]; + + } } - (void)mapViewWillStartLoadingMap:(MKMapView *)mapView