Fatal error: Unexpectedly found nil while unwrapping an Optional value in PointAnnotationController.swift
Date Reported: April 28, 2025
Affected Component: mapbox_maps_flutter
File: PointAnnotationController.swift
Line Number: 1364
Error Message:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
Description:
The application crashes with a fatal error indicating that an Optional value was unexpectedly found to be nil. This occurs in the PointAnnotationController.swift file at line 1364.
Steps to Reproduce:
I don't know how to reproduce it but it happens 1/8 time when I reload quickly multiple time
Environment:
- Mapbox Maps Flutter Plugin Version: [2.6.1]
- Flutter doctor: flutter doctor -v ─╯ [✓] Flutter (Channel stable, 3.27.3, on macOS 15.5 24F5053j darwin-arm64, locale en-US) • Flutter version 3.27.3 on channel stable at /Users/x/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision c519ee916e (3 months ago), 2025-01-21 10:32:23 -0800 • Engine revision e672b006cb • Dart version 3.6.1 • DevTools version 2.40.2
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/x/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16C5032a • CocoaPods version 1.16.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.2) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.99.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.108.0
Hi @fodedoumbouya, thank you for reporting. The crash means that we cannot create an UIImage from the given data that's fed from Flutter PointAnnotation. I have created an internal ticket https://mapbox.atlassian.net/browse/MAPSFLT-326 to track the progress, we will remove the force unwrapping in that line, meanwhile you can double check the way the image data correct when creating the point annotation.
ok I will do that Check you very much