Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: pkg/analyzer/lib/src/generated/bazel.dart

Issue 2394213002: Fix null reference issues in bazel.dart. (Closed)
Patch Set: Fix broken test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/bazel.dart
diff --git a/pkg/analyzer/lib/src/generated/bazel.dart b/pkg/analyzer/lib/src/generated/bazel.dart
index 26e6d8580ef69bb6a2f7c033360589801e2e3f2d..4f4f019966bcb53dc1c4b17536af6c08771bfc6e 100644
--- a/pkg/analyzer/lib/src/generated/bazel.dart
+++ b/pkg/analyzer/lib/src/generated/bazel.dart
@@ -91,9 +91,9 @@ class BazelWorkspace {
Folder parent = folder.parent;
// Found the READONLY folder, must be a git-based workspace.
- if (readonlySuffix != null) {
+ if (readonlySuffix != null && parent != null) {
Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY);
- if (parent != null && readonlyFolder.exists) {
+ if (readonlyFolder.exists) {
String root = folder.path;
String readonly = readonlyFolder.path;
return new BazelWorkspace._(
@@ -119,7 +119,7 @@ class BazelWorkspace {
// Go up the folder.
folder = parent;
if (folder == null) {
- return null;
+ return new BazelWorkspace._(provider, path, null, null, null);
}
}
}
@@ -139,14 +139,14 @@ class BazelWorkspace {
try {
String relative = context.relative(absolutePath, from: root);
// genfiles
- {
+ if (genfiles != null) {
File file = provider.getFile(context.join(genfiles, relative));
if (file.exists) {
return file;
}
}
// bin
- {
+ if (bin != null) {
File file = provider.getFile(context.join(bin, relative));
if (file.exists) {
return file;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698