Commit d30d5a6b authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by Robert Griesemer

go/doc: skip examples with no body

Fixes #28044

Change-Id: I0052e078dd34dc3546204416bcc5a99e3146c535
Reviewed-on: https://go-review.googlesource.com/c/140317
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
parent 007e8a2f
...@@ -68,6 +68,9 @@ func Examples(files ...*ast.File) []*Example { ...@@ -68,6 +68,9 @@ func Examples(files ...*ast.File) []*Example {
if !isTest(name, "Example") { if !isTest(name, "Example") {
continue continue
} }
if f.Body == nil { // ast.File.Body nil dereference (see issue 28044)
continue
}
var doc string var doc string
if f.Doc != nil { if f.Doc != nil {
doc = f.Doc.Text() doc = f.Doc.Text()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment