summaryrefslogtreecommitdiff
path: root/platform/macos/src
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2017-04-11 21:46:23 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2017-04-11 21:46:23 -0400
commit12b6fdbe3b1caad95089150d5c3ab69af31fb725 (patch)
tree414df39761f08c8221e9f51f73c18ced91656a11 /platform/macos/src
parent0cb05f926b7dcc18ba59c7a3c16f94860d1a0b1b (diff)
parent4d0605a004844726fc5f5e015c6d4320a880bfa0 (diff)
downloadqtlocation-mapboxgl-12b6fdbe3b1caad95089150d5c3ab69af31fb725.tar.gz
Merge branch 'release-ios-v3.5.0-android-v5.0.0' into boundsj-merge-release-branch
# Conflicts: # cmake/core-files.cmake # mapbox-gl-js # platform/android/CHANGELOG.md # platform/ios/CHANGELOG.md # platform/macos/CHANGELOG.md # platform/qt/bitrise-qt5.yml # src/mbgl/gl/attribute.hpp # src/mbgl/gl/context.cpp # src/mbgl/gl/program.hpp # src/mbgl/map/map.cpp # src/mbgl/programs/program.hpp # src/mbgl/renderer/painter.cpp
Diffstat (limited to 'platform/macos/src')
-rw-r--r--platform/macos/src/MGLMapView.mm21
1 files changed, 15 insertions, 6 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 5d14192c61..68a21b5666 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -1806,12 +1806,18 @@ public:
for (auto const& annotationTag: annotationTags)
{
- if (!_annotationContextsByAnnotationTag.count(annotationTag))
+ if (!_annotationContextsByAnnotationTag.count(annotationTag) ||
+ annotationTag == MGLAnnotationTagNotFound)
{
continue;
}
+
MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
- [annotations addObject:annotationContext.annotation];
+ NSAssert(annotationContext.annotation, @"Missing annotation for tag %u.", annotationTag);
+ if (annotationContext.annotation)
+ {
+ [annotations addObject:annotationContext.annotation];
+ }
}
return [annotations copy];
@@ -1822,11 +1828,12 @@ 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;
}
- MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag[tag];
+ MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag);
return annotationContext.annotation;
}
@@ -2063,8 +2070,8 @@ public:
// Filter out any annotation whose image is unselectable or for which
// hit testing fails.
auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) {
- NSAssert(_annotationContextsByAnnotationTag.count(annotationTag) != 0, @"Unknown annotation found nearby click");
id <MGLAnnotation> annotation = [self annotationWithTag:annotationTag];
+ NSAssert(annotation, @"Unknown annotation found nearby click");
if (!annotation) {
return true;
}
@@ -2153,9 +2160,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;
}