Skip to content

Commit 8ba83de

Browse files
authored
[iOS] Fix crash when force unwrapping image for point annotation (#970)
1 parent bddfa76 commit 8ba83de

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### main
2+
3+
* [ios] Fix crash when force unwrapping UIImage for point annotations.
4+
15
### 2.9.0-rc.1
26

37
* Update MapboxMaps to v11.13.0-rc.1

ios/mapbox_maps_flutter/Sources/mapbox_maps_flutter/Classes/Annotations/PointAnnotationController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,8 @@ extension PointAnnotation {
13511351

13521352
func toPointAnnotation() -> MapboxMaps.PointAnnotation {
13531353
var annotation = MapboxMaps.PointAnnotation(id: self.id, point: geometry)
1354-
if let image = self.image {
1355-
annotation.image = .init(image: UIImage(data: image.data, scale: UIScreen.main.scale)!, name: iconImage ?? UUID().uuidString)
1354+
if let image = image, let uiImage = UIImage(data: image.data, scale: UIScreen.main.scale) {
1355+
annotation.image = .init(image: uiImage, name: iconImage ?? UUID().uuidString)
13561356
}
13571357
if let iconAnchor {
13581358
annotation.iconAnchor = MapboxMaps.IconAnchor(iconAnchor)

0 commit comments

Comments
 (0)