Skip to content

Set TextStyle(height: double.nan), App Crash #175248

Closed

Description

@PaniniA

Steps to reproduce

  1. Build widget like : Text('text', style: TextStyle(height: x))
  2. The height 'x' is calculated and is exactly double.nan
  3. Reload my app
  4. Wait for about ten or so seconds, My app crashed

Expected results

I think the height is calculated and is exactly double.nan, It should be treated as null

Actual results

crashed

Code sample

Code sample

Text('text', style: TextStyle(height: x))

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output

[✓] Flutter (Channel stable, 3.32.8, on macOS 15.0 24A335 darwin-arm64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0-rc3)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] Proxy Configuration
[✓] Connected device (3 available)

Activity

  1. tirth-patel-nc commented on Sep 12, 2025

    @tirth-patel-nc
  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 12, 2025
  3. PaniniA commented on Sep 12, 2025

    @PaniniA
    Author
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 12, 2025
  5. PaniniA commented on Sep 12, 2025

    @PaniniA
    Author

    abstract final class double extends num {
    static const double nan = 0.0 / 0.0;
    // ...
    // ...
    }
    I do not think so height can be nan.

    @PaniniA For us to further investigate this issue, please provide a completed and minimal reproducible code sample that doesn’t include 3rd party plugins or complex production code. Also, please share the output flutter doctor -v. Thank you!

    Text('data',style: TextStyle(fontSize: 0, height: 0 / 0)), Set the fontSize to 0 and the height to 0/0 at the same time, then wait for many seconds, My app crashed

    Image
  6. AbdeMohlbi commented on Sep 12, 2025

    @AbdeMohlbi
  7. PaniniA commented on Sep 12, 2025

    @PaniniA
    Author
  8. AbdeMohlbi commented on Sep 12, 2025

    @AbdeMohlbi
  9. PaniniA commented on Sep 12, 2025

    @PaniniA
    Author
  10. AbdeMohlbi commented on Sep 12, 2025

    @AbdeMohlbi
  11. PaniniA commented on Sep 12, 2025

    @PaniniA
    Author
  12. tirth-patel-nc commented on Sep 15, 2025

    @tirth-patel-nc
  13. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 15, 2025
  14. PaniniA commented on Sep 15, 2025

    @PaniniA
    Author
  15. 21 remaining items

  16. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    d: api docsIssues with https://api.flutter.dev/
    on Sep 16, 2025
  17. added
    P2Important issues not at the top of the work list
    on Sep 16, 2025
  18. justinmc commented on Sep 16, 2025

    @justinmc
    Contributor

    I guess this probably shouldn't work, but we should have a much better error message and a consistent outcome on every platform.

  19. AbdeMohlbi commented on Oct 1, 2025

    @AbdeMohlbi
    Member

    I think this can be prevented by adding an assert to text_style.dart ?

  20. github-actions commented on Jul 24, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  21. locked as resolved and limited conversation to collaborators on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: typographyText rendering, possibly libtxtd: api docsIssues with https://api.flutter.dev/found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions