Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null check operator is used on a null value when long press a link #2271

Open
1 task done
tschiekdev opened this issue Sep 22, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working good first issue Good for newcomers minor Minimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function

Comments

@tschiekdev
Copy link
Contributor

Is there an existing issue for this?

Flutter Quill version

10.7.5

Steps to reproduce

dont know

Expected results

no error

Actual results

Null check operator used on a null value

#0 _TextLineState._longPressLink (package:flutter_quill/src/editor/widgets/text/text_line.dart:656)#1 _TextLineState._getRecognizer. (package:flutter_quill/src/editor/widgets/text/text_line.dart:623)
#2 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:351)
#3 LongPressGestureRecognizer._checkLongPressStart (package:flutter/src/gestures/long_press.dart:709)
#4 LongPressGestureRecognizer.didExceedDeadline (package:flutter/src/gestures/long_press.dart:610)
#5 PrimaryPointerGestureRecognizer.didExceedDeadlineWithEvent (package:flutter/src/gestures/recognizer.dart:731)
#6 PrimaryPointerGestureRecognizer.addAllowedPointer. (package:flutter/src/gestures/recognizer.dart:674)
#7 _rootRun (dart:async/zone.dart:1391)
#8 _CustomZone.run (dart:async/zone.dart:1301)
#9 _CustomZone.runGuarded (dart:async/zone.dart:1209)
#10 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1249)
#11 _rootRun (dart:async/zone.dart:1399)
#12 _CustomZone.run (dart:async/zone.dart:1301)
#13 _CustomZone.bindCallback. (dart:async/zone.dart:1233)
#14 Timer._createTimer. (dart:async-patch/timer_patch.dart:18)
#15 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
#16 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
#17 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184)

Additional Context

Screenshots / Video demonstration

[Upload media here]

Logs
[Paste your logs here]
@tschiekdev tschiekdev added the bug Something isn't working label Sep 22, 2024
@EchoEllet
Copy link
Collaborator

EchoEllet commented Sep 22, 2024

This line is causing the issue. Need to handle this in a better way without using the null check operator, if we're not sure why then should use assert or throw an exception with a clear message instead of return and then causing unexpected behavior that's more difficult to trace.

This commit is related.

I would avoid using dynamic in Dart (and any other language) when possible which is something that's used in Delta and Attribute, instead manually cast and handle exceptions.

@EchoEllet EchoEllet changed the title Null check operator used on a null value Null check operator is used on a null value when long press a link Sep 22, 2024
@EchoEllet EchoEllet added good first issue Good for newcomers minor Minimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers minor Minimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function
Projects
None yet
Development

No branches or pull requests

2 participants