Skip to content

Commit 223df37

Browse files
isooskevmoo
authored andcommitted
Fix NPE. Related to dart-lang#47. (dart-lang#55)
1 parent 4ef75bb commit 223df37

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/src/library_scanner.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ class LibraryScanner {
5757
PhysicalResourceProvider.INSTANCE, sdk, runPubList);
5858
var packageMapInfo = pubPackageMapProvider.computePackageMap(
5959
PhysicalResourceProvider.INSTANCE.getResource(packagePath) as Folder);
60+
6061
var packageMap = packageMapInfo.packageMap;
62+
if (packageMap == null) {
63+
throw new StateError('An error occurred getting the package map '
64+
'for the file at `$dotPackagesPath`.');
65+
}
6166

6267
var packageNames = <String>[];
6368
packageMap.forEach((k, v) {
@@ -74,10 +79,6 @@ class LibraryScanner {
7479
"Could not determine package name for package at $packagePath");
7580
}
7681

77-
if (packageMap == null) {
78-
throw new StateError('An error occurred getting the package map '
79-
'for the file at `$dotPackagesPath`.');
80-
}
8182
UriResolver packageResolver = new PackageMapUriResolver(
8283
PhysicalResourceProvider.INSTANCE, packageMap);
8384

0 commit comments

Comments
 (0)