Repository navigation
[ios] assertion to check if an annotationTag > 0 - #8588
fabian-guerra merged 2 commits into
Conversation
| continue; | ||
| } | ||
| MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); | ||
| NSAssert(_annotationContextsByAnnotationTag.count(annotationTag), @"Missing annotation for tag %u.", annotationTag); |
There was a problem hiding this comment.
This assertion checks whether there’s an entry for annotationTag in _annotationContextsByAnnotationTag. There’s no way this assertion can fail, because we already have a guard a few lines above that continues in that case. Instead, here, we need to assert that annotationContext.annotation is non-nil.
40fa216 to
15d0e77
Compare
| [annotations addObject:annotationContext.annotation]; | ||
| } | ||
| NSAssert(annotationContext.annotation, @"Missing annotation for tag %u.", annotationTag); | ||
| [annotations addObject:annotationContext.annotation]; |
There was a problem hiding this comment.
#8163 (comment) mentions supplementing the fix with an assertion. This change fully removes the guard added in #8513. We can keep the assertion although I'm now confident we will hit it (or other similar assertions) from time to time when developing because of what I described in #8163 (comment)
| [annotations addObject:annotationContext.annotation]; | ||
| } | ||
| NSAssert(annotationContext.annotation, @"Missing annotation for tag %u.", annotationTag); | ||
| [annotations addObject:annotationContext.annotation]; |
There was a problem hiding this comment.
While you’re at it, please add the same assertion and guard to the macOS implementation of -[MGLMapView visibleAnnotationsInRect:]. We should keep the two implementations consistent. Thanks!
…AnnotationsInRect
5c8651d to
6e27abe
Compare
…or_merge * release-ios-v3.5.0-android-v5.0.0: (31 commits) [qt] Renamed qt5 formula to qt macos-v0.4.1 [ios] Update podspecs and changelog for v3.5.2 [ios, macos] Guard against looking up annotation contexts MGLAnnotationTagNotFound (mapbox#8686) [ios] Update podspecs and changelog for v3.5.1 [ios, macos] Hardened std::map usage in MGLMapVIew [ios] replaced link to select a feature example (mapbox#8651) [ios, macos] Rename Data-driven styling guide (mapbox#8627) [ios] assertion to check if an annotationTag > 0 (mapbox#8588) [ios, macos] Preserve symlinks when zipping framework [ios] Silence incompatible type warning for callout view (mapbox#8608) Release android v5.0.2 (mapbox#8629) [macos] Removed MGLUserTrackingMode from jazzy ToC [macos] Fixed broken images in DDS guide [core] cache binary shaders on Android [core] Extract and de-templatize several Program static methods macos-v0.4.0 [ios, macos] Updated changelogs [ios] Replaced UIActionSheet, UIAlertView with UIAlertController [ios, macos] Copyedited data-driven styling guides ...
Addresses #8163 (comment)