From 83453a48115051e77db06262d0e3e017a791a541 Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 16 Nov 2015 11:54:16 -0800 Subject: [PATCH] Failsafe for unavailable project info (sdk#24947). See: https://github.com/dart-lang/sdk/issues/24947 R=scheglov@google.com Review URL: https://codereview.chromium.org//1447123002 . --- CHANGELOG.md | 4 ++++ lib/src/rules/package_prefixed_library_names.dart | 5 +++++ pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a35ae951f..3bf70cb06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.1.6 + +* Fix to `package_prefixed_library_names` (dart-lang/sdk#24947; #154). + # 0.1.5 * Added `prefer_is_not_empty` lint rule (#143). diff --git a/lib/src/rules/package_prefixed_library_names.dart b/lib/src/rules/package_prefixed_library_names.dart index 15f0e0c9f..da450ac7c 100644 --- a/lib/src/rules/package_prefixed_library_names.dart +++ b/lib/src/rules/package_prefixed_library_names.dart @@ -80,6 +80,11 @@ class Visitor extends SimpleAstVisitor { @override visitLibraryDirective(LibraryDirective node) { + // If no project info is set, bail early. + // https://github.com/dart-lang/linter/issues/154 + if (project == null) { + return; + } Source source = node.element.source; var prefix = createLibraryNamePrefix( libraryPath: source.fullName, diff --git a/pubspec.yaml b/pubspec.yaml index 6c2eb781d..a89ecf6c9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: linter -version: 0.1.5 +version: 0.1.6 author: Dart Team description: Style linter for Dart. homepage: https://github.com/dart-lang/linter