summaryrefslogtreecommitdiff
path: root/platform/macos/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r--platform/macos/src/MGLMapView.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index a5a5c53df3..a873d9ef82 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -1796,10 +1796,12 @@ public:
for (auto const& annotationTag: annotationTags)
{
- if (!_annotationContextsByAnnotationTag.count(annotationTag))
+ if (!_annotationContextsByAnnotationTag.count(annotationTag) ||
+ annotationTag == MGLAnnotationTagNotFound)
{
continue;
}
+
MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
NSAssert(annotationContext.annotation, @"Missing annotation for tag %u.", annotationTag);
if (annotationContext.annotation)
@@ -1816,7 +1818,8 @@ public:
/// Returns the annotation assigned the given tag. Cheap.
- (id <MGLAnnotation>)annotationWithTag:(MGLAnnotationTag)tag {
- if (!_annotationContextsByAnnotationTag.count(tag)) {
+ if ( ! _annotationContextsByAnnotationTag.count(tag) ||
+ tag == MGLAnnotationTagNotFound) {
return nil;
}
@@ -2147,9 +2150,11 @@ public:
}
- (id <MGLAnnotation>)selectedAnnotation {
- if (!_annotationContextsByAnnotationTag.count(_selectedAnnotationTag)) {
+ if ( ! _annotationContextsByAnnotationTag.count(_selectedAnnotationTag) ||
+ _selectedAnnotationTag == MGLAnnotationTagNotFound) {
return nil;
}
+
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(_selectedAnnotationTag);
return annotationContext.annotation;
}