Skip to content

Commit

Permalink
fix(gazelle): fix nil pointer exception
Browse files Browse the repository at this point in the history
bazel-contrib#1099 introduced a nil pointer exception happening when BUILD files contain a # keep note.
  • Loading branch information
codesuki committed Dec 8, 2017
1 parent 7b0091d commit 2ca8278
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/tools/gazelle/gazelle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func run(c *config.Config, cmd command, emit emitFunc) {
g := rules.NewGenerator(c, l, file)
rules, empty := g.GenerateRules(pkg)
file, rules = merger.MergeFile(rules, empty, file, merger.MergeableGeneratedAttrs)
if file == nil {
return
}
if file.Path == "" {
file.Path = filepath.Join(c.RepoRoot, filepath.FromSlash(rel), c.DefaultBuildFileName())
}
Expand Down

0 comments on commit 2ca8278

Please sign in to comment.