Skip to content

fix: pre hook script: Null check operator used on a null value #1124

@a-wallen

Description

@a-wallen

Description

A clear and concise description of what the bug is.

I'm running dart_frog build and hitting this error:

An exception occurred while executing hook: C:\Users\awallen\AppData\Local\Mason\Cache\bundled\dart_frog_prod_server_0.1.0+1_dd63917756d9b4f8fd323148a45cb9d6c977ffb9\hooks\pre_gen.dart. Error: Null check operator used on a null value 

pre_gen.dart:103
I ran through the pre_gen.dart hook and it appears that the assertion is properly guarded

 'globalMiddleware': configuration.globalMiddleware != null ? configuration.globalMiddleware!.toJson() : false, 

Steps To Reproduce

  1. Create a Dart Frog project:
dart_frog create sample
  1. Adding an overridden dependency that has no matching main or dev dependency (from sample/):
dart pub add 'override:meta:'
  1. Building a Dart Frog project (from sample/):
dart_frog build
  1. See the error:
✓ Installing dependencies (0.4s) ✓ Bundling sources (13ms) An exception occurred while executing hook: /Users/alestiago/.mason-cache/bundled/dart_frog_prod_server_0.1.0+1_e4edd283c6291e9406142f96559194db57c10097/hooks/pre_gen.dart. Error: Null check operator used on a null value

You can access a sample with these changes at the dart_frog-1124-20240126 branch.

Expected Behavior

Builds fine.

Additional Context

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions