flutter_image_compress icon indicating copy to clipboard operation
flutter_image_compress copied to clipboard

iOS crash: Data cannot be nil

Open Lcccocoa opened this issue 4 years ago • 6 comments

crash log:

#49 Thread NSInternalInconsistencyException Data cannot be nil

0 CoreFoundation | ___exceptionPreprocess + 224 1 libobjc.A.dylib | objc_exception_throw + 56 2 CoreFoundation | +[_CFXNotificationTokenRegistration keyCallbacks] 3 Foundation | -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128 4 Flutter | -[FlutterStandardTypedData initWithData:type:] (FlutterStandardCodec.mm:176) 5 Flutter | +[FlutterStandardTypedData typedDataWithData:type:] (FlutterStandardCodec.mm:171) 6 flutter_image_compress | -[CompressListHandler handleMethodCall:result:] + 700 7 flutter_image_compress | __54-[FlutterImageCompressPlugin handleMethodCall:result:]_block_invoke + 212

Lcccocoa avatar Apr 19 '21 08:04 Lcccocoa

flutter_native_image user this plugin instead

bhanuka96 avatar Jul 12 '21 18:07 bhanuka96

@Lcccocoa Did you find the root cause or a way to fix it ?

bounty1342 avatar Feb 21 '22 13:02 bounty1342

We are also still seeing this issue. Here is the report output

Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: 5CFCAE9E-3F65-4B7A-81EE-69522CCEEA8F
CrashReporter Key:   ADC3487B-F6CC-3AFF-4EBC-16D1B1E7987C
Hardware Model:      Macmini9,1
Process:             Runner [88136]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/0D5D13CA-7B21-4389-B858-D00D92548C93/data/Containers/Bundle/Application/273364A0-64AA-4024-A76A-5A708CBCDB78/Runner.app/Runner
Identifier:          teamdigital.flutter.firebase.poc
Version:             1.1.7 (31)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [39514]
Coalition:           com.apple.CoreSimulator.SimDevice.0D5D13CA-7B21-4389-B858-D00D92548C93 [5414]
Responsible Process: SimulatorTrampoline [694]
Date/Time:           2022-05-09 16:01:14.2730 -0600
Launch Time:         2022-05-09 16:00:56.2734 -0600
OS Version:          macOS 12.2.1 (21D62)
Release Type:        User
Report Version:      104
Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  27
Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
CoreSimulator 783.5 - Device: Mitch Test Phone (0D5D13CA-7B21-4389-B858-D00D92548C93) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 11
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Data cannot be nil'
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
abort() called
Last Exception Backtrace:
0   CoreFoundation                         0x1803e1174 __exceptionPreprocess + 216
1   libobjc.A.dylib                        0x180193384 objc_exception_throw + 56
2   Foundation                             0x180746648 _userInfoForFileAndLine + 0
3   Flutter                                0x10b3ca548 -[FlutterStandardTypedData initWithData:type:] + 276
4   Flutter                                0x10b3ca428 +[FlutterStandardTypedData typedDataWithData:type:] + 52
5   flutter_image_compress                 0x101196798 -[CompressListHandler handleMethodCall:result:] + 864 (CompressListHandler.m:35)
6   flutter_image_compress                 0x101196b10 __54-[FlutterImageCompressPlugin handleMethodCall:result:]_block_invoke + 160 (FlutterImageCompressPlugin.m:24)
7   libdispatch.dylib                      0x180108db0 _dispatch_call_block_and_release + 24
8   libdispatch.dylib                      0x18010a5a4 _dispatch_client_callout + 16
9   libdispatch.dylib                      0x18010d440 _dispatch_queue_override_invoke + 768
10  libdispatch.dylib                      0x18011b37c _dispatch_root_queue_drain + 432
11  libdispatch.dylib                      0x18011bd28 _dispatch_worker_thread2 + 160
12  libsystem_pthread.dylib                0x1c99caa98 _pthread_wqthread + 224
13  libsystem_pthread.dylib                0x1c99c988c start_wqthread + 8

MicrosoftTeams-image (11) When we invoke the method, that's where it eventually crashes. The return statement is never reached. This is a relatively new project.

jakehockey10 avatar May 09 '22 22:05 jakehockey10

Having the same issue :/ Will be using the image package until it's fixed. I would also like to help fix it (if required).

krispykalsi avatar Jul 17 '22 14:07 krispykalsi

Looking at the source code it seems that UIImageJPEGRepresentation can return nil in some cases in the CompressHandler class. then FlutterStandardTypedData typedDataWithBytes:compressedData in CompressListHandler crash.

Klabauterman avatar Jul 20 '22 20:07 Klabauterman

I can create a pr if this repo is still active.

Klabauterman avatar Jul 20 '22 20:07 Klabauterman