From 2ca8278f5b7a4e9ebe8eb7307f2b2b10187791b7 Mon Sep 17 00:00:00 2001 From: Neri Marschik Date: Fri, 8 Dec 2017 15:04:57 +0900 Subject: [PATCH] fix(gazelle): fix nil pointer exception #1099 introduced a nil pointer exception happening when BUILD files contain a # keep note. --- go/tools/gazelle/gazelle/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go/tools/gazelle/gazelle/main.go b/go/tools/gazelle/gazelle/main.go index 36d9ad870f..3cbe9b7c8c 100644 --- a/go/tools/gazelle/gazelle/main.go +++ b/go/tools/gazelle/gazelle/main.go @@ -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()) }