Skip to content

SelectableRegion Widget crash due to 'Null check operator used on a null value' (Firebase Crashalytics) #123378

@rohanjsh

Description

@rohanjsh

Description:
I have been using the SelectableRegion Widget in my Flutter application, and I have encountered two issues related to Null check operator used on a null value. These issues have been reported by Firebase Crashlytics, and I have not been able to reproduce them on my local machine. Hence, I would like to report them to the Flutter repository.

Issue 1:
In the file 'package:flutter/src/widgets/selectable_region.dart' at line number 609, there is a Null check operator used on a null value error. The error occurs when the '_updateLastEdgeEventsFromGeometries' function is called. It seems that the 'lastParagraph' variable is null, which causes the error.
Stack Trace

package:flutter/src/widgets/selectable_region.dart:609
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
       at _SelectableRegionContainerDelegate._updateLastEdgeEventsFromGeometries(selectable_region.dart:1285)
       at _SelectableRegionContainerDelegate.handleSelectWord(selectable_region.dart:1314)
       at MultiSelectableSelectionContainerDelegate.dispatchSelectionEvent(selectable_region.dart:2014)
       at _SelectionContainerState.dispatchSelectionEvent(selection_container.dart:187)
       at SelectableRegionState._selectWordAt(selectable_region.dart:857)
       at SelectableRegionState._handleTouchLongPressStart(selectable_region.dart:472)
       at LongPressGestureRecognizer._checkLongPressStart.<fn>(long_press.dart:720)
       at GestureRecognizer.invokeCallback(recognizer.dart:253)
       at LongPressGestureRecognizer._checkLongPressStart(long_press.dart:720)
       at LongPressGestureRecognizer.didExceedDeadline(long_press.dart:618)
       at PrimaryPointerGestureRecognizer.didExceedDeadlineWithEvent(recognizer.dart:643)
       at PrimaryPointerGestureRecognizer.addAllowedPointer.<fn>(recognizer.dart:586)

Issue 2:
In the same file 'package:flutter/src/widgets/selectable_region.dart' at line number 634, there is another Null check operator used on a null value error. The error occurs when the '_handleSelectionStartHandleDragUpdate' function is called. It seems that the 'endHandle' variable is null, which causes the error.
Stack Trace

package:flutter/src/widgets/selectable_region.dart:634
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
       at SelectableRegionState._handleSelectionStartHandleDragUpdate(selectable_region.dart:609)
       at DragGestureRecognizer._checkUpdate.<fn>(monodrag.dart:483)
       at GestureRecognizer.invokeCallback(recognizer.dart:253)
       at DragGestureRecognizer._checkUpdate(monodrag.dart:483)
       at DragGestureRecognizer.handleEvent(monodrag.dart:330)
       at PointerRouter._dispatch(pointer_router.dart:98)
       at PointerRouter._dispatchEventToRoutes.<fn>(pointer_router.dart:143)
       at _LinkedHashMapMixin.forEach(dart:collection)
       at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141)
       at PointerRouter.route(pointer_router.dart:127)
       at GestureBinding.handleEvent(binding.dart:460)
       at GestureBinding.dispatchEvent(binding.dart:440)
       at RendererBinding.dispatchEvent(binding.dart:336)
       at GestureBinding._handlePointerEventImmediately(binding.dart:395)
       at GestureBinding.handlePointerEvent(binding.dart:357)
       at GestureBinding._flushPointerEventQueue(binding.dart:314)
       at GestureBinding._handlePointerDataPacket(binding.dart:295)

Steps to Reproduce:
As mentioned earlier, I have not been able to reproduce these errors on my local machine. However, the errors are occurring on user devices, which suggests that they are related to some specific conditions or configurations.

Expected Result:
The SelectableRegion Widget should work without any Null check operator errors.

Actual Result:
The Null check operator used on a null value error occurs in the SelectableRegion Widget.

Additional Information:

Widget tree looks something like this
Screenshot 2023-03-24 at 10 51 39

I have attached the stack traces of the errors in the Firebase Crashlytics console.
Any help or suggestions regarding these issues would be appreciated.

Screenshot from crashalytics console

Screenshot 2023-03-24 at 10 55 08

Thank you.

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: error messageError messages from the Flutter frameworka: null-safetySupport for Dart's null safety featurec: crashStack traces logged to the consolef: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.7Found to occur in 3.7found in release: 3.9Found to occur in 3.9frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions