From 05b06a69261aa63f288989b02bf87a827b03dbe1 Mon Sep 17 00:00:00 2001 From: Adrian Cojocaru Date: Wed, 5 Nov 2025 12:57:17 +0200 Subject: [PATCH] Add accessibility annotation check (#3926) --- platform/ios/src/MLNMapView.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index 56f5a385c..7f6ef9266 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -3550,7 +3550,12 @@ static void *windowScreenContext = &windowScreenContext; - (id)accessibilityElementForAnnotationWithTag:(MLNAnnotationTag)annotationTag { MLNAssert(_annotationContextsByAnnotationTag.count(annotationTag), @"Missing annotation for tag %llu.", annotationTag); - MLNAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); + auto annotationContextIt = _annotationContextsByAnnotationTag.find(annotationTag); + if (annotationContextIt == _annotationContextsByAnnotationTag.end()) { + return nil; + } + + MLNAnnotationContext &annotationContext = annotationContextIt->second; id annotation = annotationContext.annotation; // Let the annotation view serve as its own accessibility element.