Fixed array bounds error in MapView

Summary: fixed a case where MapView could crash due to a race condition

Differential Revision: D3207304

fb-gh-sync-id: a63918d160258d76fce5d56994100a63f4c5fb68
fbshipit-source-id: a63918d160258d76fce5d56994100a63f4c5fb68
This commit is contained in:
Labeeb Panampullan
2016-04-22 10:58:48 -07:00
committed by Facebook Github Bot 0
parent 7192984c13
commit 446d7b7c17

View File

@@ -179,7 +179,8 @@ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RCTMap)
}
MKAnnotationView *annotationView;
if (annotation.viewIndex != NSNotFound) {
if (annotation.viewIndex != NSNotFound &&
annotation.viewIndex < mapView.reactSubviews.count) {
NSString *reuseIdentifier = NSStringFromClass([RCTMapAnnotationView class]);
annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier];