summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2017-03-10 14:49:22 -0800
committerGitHub <noreply@github.com>2017-03-10 14:49:22 -0800
commitffce46cae6cdc3a4b952a0aeca80b5d5f7304b6d (patch)
tree706d4746e4c791a1dde73d309606237b54ab4f31 /platform
parent6c6e895b23a434ca0abaad2a92c4b19ea4fd3976 (diff)
downloadqtlocation-mapboxgl-ffce46cae6cdc3a4b952a0aeca80b5d5f7304b6d.tar.gz
Raise exception when MGLAnnotationView.annotation property is nil (#8339)
* [ios] MGLAnnotationView annotation property made writable * [ios] standarized exception name for annotations
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/src/MGLAnnotationView.mm5
-rw-r--r--platform/ios/src/MGLMapView.mm8
2 files changed, 10 insertions, 3 deletions
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index 0e904779d5..5e0ae3b848 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -239,7 +239,10 @@
}
else if (dragState == MGLAnnotationViewDragStateCanceling)
{
- NSAssert(self.annotation, @"Annotation property should not be nil.");
+ if (!self.annotation) {
+ [NSException raise:NSInvalidArgumentException
+ format:@"Annotation property should not be nil."];
+ }
self.panGestureRecognizer.enabled = NO;
self.longPressRecognizer.enabled = NO;
self.center = [self.mapView convertCoordinate:self.annotation.coordinate toPointToView:self.mapView];
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index f0aa2804a6..8872261a88 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1519,14 +1519,18 @@ public:
return nil;
}
}
-
+
// Handle the case of an offset annotation view by converting the tap point to be the geo location
// of the annotation itself that the view represents
for (MGLAnnotationView *view in self.annotationContainerView.annotationViews)
{
if (view.centerOffset.dx != 0 || view.centerOffset.dy != 0) {
if (CGRectContainsPoint(view.frame, tapPoint)) {
- NSAssert(view.annotation, @"Annotation's view annotation property should not be nil.");
+ if (!view.annotation) {
+ [NSException raise:NSInvalidArgumentException
+ format:@"Annotation view's annotation property should not be nil."];
+ }
+
CGPoint annotationPoint = [self convertCoordinate:view.annotation.coordinate toPointToView:self];
tapPoint = annotationPoint;
}