flutter_image_compress icon indicating copy to clipboard operation
flutter_image_compress copied to clipboard

[Bug report] flutter_image_compress_macos/FlutterImageCompressMacosPlugin.swift:319: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Open Tom3652 opened this issue 5 months ago • 1 comments

Version

2.4.0

Platforms

macOS

Device Model

MacOS 15.6

flutter info

[✓] Flutter (Channel stable, 3.32.8, on macOS 15.6 24G84 darwin-x64, locale fr-FR) [1 027ms]
    • Flutter version 3.32.8 on channel stable at /Users/foxtom/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision edada7c56e (5 days ago), 2025-07-25 14:08:03 +0000
    • Engine revision ef0cd00091
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [5,8s]
    • Android SDK at /Users/foxtom/Library/Android/sdk
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [5,9s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [62ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [59ms]
    • 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.6+-13391695-b895.109)

[✓] VS Code (version 1.102.2) [53ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (5 available) [8,0s]
    • SM A525F (mobile)                  • 192.168.1.18:45505        • android-arm64  • Android 14 (API 34)
    • iPhone de Aude (wireless) (mobile) • 00008140-001170500278801C • ios            • iOS 18.5 22F76
    • Now You See Me (wireless) (mobile) • 00008020-001204401E78002E • ios            • iOS 18.6 22G86
    • macOS (desktop)                    • macos                     • darwin-x64     • macOS 15.6 24G84 darwin-x64
    • Chrome (web)                       • chrome                    • web-javascript • Google Chrome 138.0.7204.169

[✓] Network resources [530ms]
    • All expected network resources are available.

• No issues found!

How to reproduce?

Call the below code in debug mode on macos with valid params.

Logs

Version:               1.0.0 (1)
Code Type:             X86-64 (Native)
Parent Process:        dart [57264]
Responsible:           studio [50013]
User ID:               501

Date/Time:             2025-07-30 17:39:27.8507 +0200
OS Version:            macOS 15.6 (24G84)
Report Version:        12
Bridge OS Version:     9.6 (22P6083)
Anonymous UUID:        3A8621C5-8481-BE2C-DF36-91742B459CCB

Sleep/Wake UUID:       E3D2AAEC-A1B3-4470-B72B-12EC2CABBE99

Time Awake Since Boot: 26000 seconds
Time Since Wake:       13665 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process:   exc handler [63068]

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib            	    0x7ff8146790e5 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 309
1   libswiftCore.dylib            	    0x7ff814678ed5 closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 325
2   libswiftCore.dylib            	    0x7ff814678d4c closure #1 in _assertionFailure(_:_:file:line:flags:) + 380
3   libswiftCore.dylib            	    0x7ff814678985 _assertionFailure(_:_:file:line:flags:) + 277
4   flutter_image_compress_macos  	       0x10ffebfbd closure #1 in Compressor.compressToPath(_:_:) + 301 (FlutterImageCompressMacosPlugin.swift:319)
5   flutter_image_compress_macos  	       0x10ffebae4 Compressor.compress(destCreator:) + 2020 (FlutterImageCompressMacosPlugin.swift:310)
6   flutter_image_compress_macos  	       0x10ffebdd3 Compressor.compressToPath(_:_:) + 243 (FlutterImageCompressMacosPlugin.swift:318)
7   flutter_image_compress_macos  	       0x10ffe8ced FlutterImageCompressMacosPlugin.handle(_:result:) + 1597 (FlutterImageCompressMacosPlugin.swift:154)
8   flutter_image_compress_macos  	       0x10ffe90c6 @objc FlutterImageCompressMacosPlugin.handle(_:result:) + 118
9   FlutterMacOS                  	       0x117a3e12d __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 173
10  FlutterMacOS                  	       0x116cc84aa -[FlutterEngine engineCallbackOnPlatformMessage:] + 490
11  FlutterMacOS                  	       0x117640815 std::_fl::__function::__func<FlutterEngineInitialize::$_3, std::_fl::allocator<FlutterEngineInitialize::$_3>, void (std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>)>::operator()(std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>&&) + 133
12  FlutterMacOS                  	       0x11765466a flutter::PlatformViewEmbedder::HandlePlatformMessage(std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>) + 74
13  FlutterMacOS                  	       0x117654fc8 std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::PlatformViewEmbedder::EmbedderPlatformMessageHandler::HandlePlatformMessage(std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>)::'lambda'()>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::PlatformViewEmbedder::EmbedderPlatformMessageHandler::HandlePlatformMessage(std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>)::'lambda'()>>, void ()>::operator()() + 72
14  FlutterMacOS                  	       0x1176514c1 flutter::EmbedderTaskRunner::PostTask(unsigned long long) + 785
15  FlutterMacOS                  	       0x1176446d9 flutter::EmbedderEngine::RunTask(FlutterTask const*) + 57
16  FlutterMacOS                  	       0x11763829f FlutterEngineRunTask + 63
17  FlutterMacOS                  	       0x116ccb663 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 67
18  FlutterMacOS                  	       0x116cdc886 -[FlutterRunLoop performExpiredTasks] + 662
19  CoreFoundation                	    0x7ff80281eab0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20  CoreFoundation                	    0x7ff80281ea52 __CFRunLoopDoSource0 + 157
21  CoreFoundation                	    0x7ff80281e80d __CFRunLoopDoSources0 + 203
22  CoreFoundation                	    0x7ff80281d476 __CFRunLoopRun + 973
23  CoreFoundation                	    0x7ff80281ca72 CFRunLoopRunSpecific + 536
24  HIToolbox                     	    0x7ff80e30e0d4 RunCurrentEventLoopInMode + 281
25  HIToolbox                     	    0x7ff80e310f97 ReceiveNextEventCommon + 499
26  HIToolbox                     	    0x7ff80e49a19a _BlockUntilNextEventMatchingListInModeWithFilter + 63
27  AppKit                        	    0x7ff806281db1 _DPSNextEvent + 912
28  AppKit                        	    0x7ff806d10137 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1263
29  AppKit                        	    0x7ff806272e99 -[NSApplication run] + 610
30  AppKit                        	    0x7ff806246005 NSApplicationMain + 803
31  myappname.debug.dylib	       0x10f04e324 static NSApplicationDelegate.main() + 36
32  myappname.debug.dylib	       0x10f04e2f7 static AppDelegate.$main() + 39
33  myappname.debug.dylib	       0x10f04e388 __debug_main_executable_dylib_entry_point + 24
34  dyld                          	    0x7ff802390530 start + 3056


And during the debug i have this log before the crash : 


flutter_image_compress_macos/FlutterImageCompressMacosPlugin.swift:319: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Example code (optional)

XFile? file = await FlutterImageCompress.compressAndGetFile(photoPath, output, minHeight: minHeight, minWidth: minWidth, quality: quality);

Contact

No response

Tom3652 avatar Jul 30 '25 15:07 Tom3652

i have not seen that there is an ongoing issue for a year now #314 i will fix it myself then

Tom3652 avatar Aug 27 '25 08:08 Tom3652