Skip to content

Crash: Null check operator used on a null value in RenderEditable.selectWord on text selection/long-press #231

Description

@7H3-PR073C70R

name: Bug report
about: Create a report to help us improve
title: 'Crash: Null check operator used on a null value in RenderEditable.selectWord'
labels: 'bug'
assignees: Tkko


Describe the bug
A crash occurs deep within Flutter's internal text selection logic (RenderEditable.selectWord) when a user long-presses or performs a tap-hold gesture on a Pinput widget cell. During the selection gesture, the engine attempts to select a word but encounters a null or inconsistent layout/text position state in the underlying RenderEditable.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to any screen containing a active Pinput field.
  2. Tap and hold (long-press) on any of the pin input cells.
  3. Observe the immediate application crash.

Screenshots
N/A (Crashes instantly)

Pinput version: 6.0.2

Result of: flutter doctor --verbose

Details [✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-NG) • Flutter version 3.22.2 on channel stable at /Users/protector/development/flutter • Framework • revision 7617478bcf (9 months ago) • 2024-06-05 22:15:13 +0200 • Engine • revision 2a40c17a5c • Dart SDK version 3.4.3 • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/protector/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2

[✓] Chrome - develop for the web
• Chrome version 126.0.6478.61

[✓] Android Studio (version 2023.3)
• 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/9354-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.90.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Gutter Icons extension version 1.1.1

[✓] Connected device (3 available)
• SM A145F (mobile) • R9PX30DLYLJ • android-34 • Android 14 (API 34)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.61

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

Smartphone:

  • Device: Samsung Galaxy A14
  • OS: Android 14 (API 34)
  • Version: 14

Additional context
Setting enableInteractiveSelection: false does not fully prevent the crash on all Android versions, as the system selection overlay/magnifier may still try to call the text selector.

A reliable workaround we implemented was to fully suppress the text selection context menu builder:

Pinput(
  enableInteractiveSelection: false,
  contextMenuBuilder: (_, _) => const SizedBox.shrink(),
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions