Skip to content

Crash: Null check operator used on a null value #4021

Closed
@gs0-debiotech

Description

@gs0-debiotech

When running dartdoc on our application, we get the following failure:

$ dartdoc
Documenting app...
Discovering libraries...
Linking elements...
Precaching local docs for 151614 elements...
Initialized dartdoc with 366 libraries
[...snip...]
Generating docs for library data/dao/app_database_dao.dart from file:///builds/app/lib/data/dao/app_database_dao.dart...
dartdoc 8.3.3 (/root/.pub-cache/global_packages/dartdoc/bin/dartdoc.dart-3.7.0.snapshot) failed: Null check operator used on a null value
#0      Prefix.associatedLibrary (package:dartdoc/src/model/prefix.dart:30:54)
#1      Prefix.associatedLibrary (package:dartdoc/src/model/prefix.dart)
#2      Prefix.canonicalModelElement (package:dartdoc/src/model/prefix.dart:42:41)
#3      Prefix.href (package:dartdoc/src/model/prefix.dart:51:23)
#4      PackageGraph.allHrefs (package:dartdoc/src/model/package_graph.dart:599:33)
#5      new Validator (package:dartdoc/src/validator.dart:38:32)
#6      Dartdoc.generateDocsBase (package:dartdoc/src/dartdoc.dart:209:7)
<asynchronous suspension>
#7      Dartdoc.generateDocs (package:dartdoc/src/dartdoc.dart:241:24)
<asynchronous suspension>
#8      Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/src/dartdoc.dart:273:9)
<asynchronous suspension>

Link to prefix.dart:30 as of today.

I do not know whether it's linked to the last file read. In case it is, here is the code:

import 'dart:io';

import 'package:app/data/app_database.dart';
import 'package:drift/drift.dart';

part '../../generated/data/dao/app_database_dao.g.dart';

@DriftAccessor()
class AppDatabaseDao extends DatabaseAccessor<AppDatabase> with _$AppDatabaseDaoMixin {
  AppDatabaseDao(super.attachedDatabase);

  Future<void> exportInto(File file) async {
    await file.parent.create(recursive: true);
    await customStatement('VACUUM INTO ?', [file.path]);
  }
}

When checking since when it fails in our pipeline, I do not see anything special in the corresponding commit: only changes in the Dart code, few annotations used (@Freezed(toStringOverride), but nothing related to the tooling.

For context, it's running in a Linux gitlab worker, using the flutter:3.27.1 container from CirrusLabs up to flutter:3.29.1. The setup runs dart pub global activate dartdoc (which ends with Activated dartdoc 8.3.3, and the command is dartdoc.

I tried to replicate it locally (with Flutter 3.29.1 on macOS), and the doc generation works correctly, without a crash.

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requesttype-uxA user experience or user interface related issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions