Skip to content

Commit ad48c76

Browse files
authored
Fix a potential NPE (#1331)
1 parent ff5a15a commit ad48c76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

warn/warn_bazel_api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ var moduleToApparentRepoName func(string) string
180180
// useApparentRepoNameIfExternal replaces the module name in a load statement with the apparent repository
181181
// name used by the root Bazel module (if any).
182182
func useApparentRepoNameIfExternal(load string, fileReader *FileReader) string {
183-
if !strings.HasPrefix(load, "@") {
184-
// Not a load from an external repository.
183+
if !strings.HasPrefix(load, "@") || fileReader == nil {
184+
// Not a load from an external repository or we can't load external files.
185185
return load
186186
}
187187
if moduleToApparentRepoName == nil {

0 commit comments

Comments
 (0)