flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

NSInvalidArgumentException, reason: '-[NSNull longLongValue]: unrecognized selector sent to instance

Open andrescastane opened this issue 6 months ago • 4 comments

Have you checked for an existing issue?

Flutter Quill Version

11.4.0

Steps to Reproduce

On Flutter v 3.32.0-0.5.pre. The application crashes when focusing on the Quill editor on macOS. On Windows, it doesn't crash but it doesn't allow typing. Everything works fine on the stable version of Flutter, but when I switch to this version, it doesn't work.

I found something that might be useful in this article:

https://medium.com/@ali.hussnainbabar/terminating-app-due-to-uncaught-exception-nsinvalidargumentexception-how-a-null-value-caused-4149d8ee0b91

It discusses how a NSInvalidArgumentException caused by a null value can terminate the app. It could be related to the issue I'm facing with the Quill editor.

Expected results

This issue only occurs after switching to the new version, so it would be important to ensure compatibility is maintained across versions.

Actual results

** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull longLongValue]: unrecognized selector sent to instance 0x2041084a0' *** First throw call stack: ( 0 CoreFoundation 0x0000000193f65df0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000193a2ab60 objc_exception_throw + 88 2 CoreFoundation 0x0000000194022ce0 -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x0000000193ed3efc forwarding + 1500 4 CoreFoundation 0x0000000193ed3860 _CF_forwarding_prep_0 + 96 5 FlutterMacOS 0x0000000108f81e34 -[FlutterTextInputPlugin handleMethodCall:result:] + 2324 6 FlutterMacOS 0x0000000109c374b4 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 180 7 FlutterMacOS 0x0000000108f6a748 -[FlutterEngine engineCallbackOnPlatformMessage:] + 416 8 FlutterMacOS 0x000000010983b024 _ZNSt3_fl10__function6__funcIZ23FlutterEngineInitializeE3$3NS_9allocatorIS2_EEFvNS_10unique_ptrIN7flutter15PlatformMessageENS_14default_deleteIS7_EEEEEEclEOSA + 128 9 FlutterMacOS 0x000000010984e7f4 _ZN7flutter20PlatformViewEmbedder21HandlePlatformMessageENSt3_fl10unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE + 76 10 FlutterMacOS 0x000000010984f384 _ZNSt3_fl10__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter20PlatformViewEmbedder30EmbedderPlatformMessageHandler21HandlePlatformMessageENS_10unique_ptrINS5_15PlatformMessageENS_14defa 11 FlutterMacOS 0x000000010984b3c4 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 652 12 FlutterMacOS 0x000000010983f95c _ZN7flutter14EmbedderEngine7RunTaskEPK11FlutterTask + 56 13 FlutterMacOS 0x0000000109832890 FlutterEngineRunTask + 68 14 FlutterMacOS 0x0000000108f6daa8 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 72 15 FlutterMacOS 0x0000000108f7d734 -[FlutterRunLoop performExpiredTasks] + 524 16 CoreFoundation 0x0000000193ef4de4 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 17 CoreFoundation 0x0000000193ef4d78 __CFRunLoopDoSource0 + 172 18 CoreFoundation 0x0000000193ef4ae4 __CFRunLoopDoSources0 + 232 19 CoreFoundation 0x0000000193ef3738 __CFRunLoopRun + 840 20 CoreFoundation 0x0000000193ef2d68 CFRunLoopRunSpecific + 572 21 HIToolbox 0x000000019f6a627c RunCurrentEventLoopInMode + 324 22 HIToolbox 0x000000019f6a94e8 ReceiveNextEventCommon + 676 23 HIToolbox 0x000000019f834484 _BlockUntilNextEventMatchingListInModeWithFilter + 76 24 AppKit 0x0000000197b45ab4 _DPSNextEvent + 684 25 AppKit 0x00000001984e4314 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 26 AppKit 0x0000000197b38c64 -[NSApplication run] + 480 27 AppKit 0x0000000197b0f35c NSApplicationMain + 880 28 Traiker Platform.debug.dylib 0x00000001020b647c $sSo21NSApplicationDelegateP6AppKitE4mainyyFZ + 40 29 Traiker Platform.debug.dylib 0x00000001020b6444 $s16Traiker_Platform11AppDelegateC5$mainyyFZ + 44 30 Traiker Platform.debug.dylib 0x00000001020b64e4 __debug_main_executable_dylib_entry_point + 28 31 dyld 0x0000000193a6ab4c start + 6000 ) libc++abi: terminating due to uncaught exception of type NSException [Sentry] [debug] [timeIntervalSince1970:1747727986.280474] [SentryCrashMonitor_NSException:62] Trapped exception -[NSNull longLongValue]: unrecognized selector sent to instance 0x2041084a0 [Sentry] [debug] [timeIntervalSince1970:1747727986.280591] [SentryCrashMonitor_NSException:69] Filling out context. [Sentry] [debug] [timeIntervalSince1970:1747727986.2806711] [SentryCrashMonitor_NSException:99] Calling main crash handler. [Sentry] [debug] [timeIntervalSince1970:1747727986.346744] [SentryCrashMonitor_NSException:134] Restoring original handler. [Sentry] [debug] [timeIntervalSince1970:1747727986.346774] [SentryCrashMonitor_NSException:104] Calling original exception handler. Lost connection to device.

Additional Context

Screenshots / Video demonstration

[Attach media here]

Logs
[Paste logs here]

andrescastane avatar May 20 '25 08:05 andrescastane

same issue

kketanssharma avatar May 21 '25 16:05 kketanssharma

The issue encountered appears to be related to the Flutter framework bug reported in flutter/flutter#169204.

fabionuno avatar May 21 '25 19:05 fabionuno

This impacts Windows as well: the widget becomes unusable.

For those willing a fix right now, you can use the PR submitted here to fix the bug. Add this to your pubspec.yaml:

dependency_overrides: 
  flutter_quill:
    git:
      url: https://github.com/theniceboy/flutter-quill.git
      ref: fix-flutter-3-32-macos-crash

idispatch75 avatar May 26 '25 09:05 idispatch75

This impacts Windows as well: the widget becomes unusable.

I rolled flutter back to 3.29.

It is the same issue deep inside flutter as mentioned above, still exists in 3.32.1.

realth000 avatar May 26 '25 10:05 realth000

I can confirm the one-line patch of @theniceboy (https://github.com/singerdmx/flutter-quill/pull/2579) fixes this crash on macOS.

gferon avatar Jun 19 '25 09:06 gferon