]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/doc/example.go
[dev.fuzz] all: merge master (d137b74) into dev.fuzz
[gostls13.git] / src / go / doc / example.go
index 094d7ba61bd98f9cf6531ef363e610730922035d..fbbd846354608c80b9eb247bd3f5cfeb33e3474e 100644 (file)
@@ -237,7 +237,10 @@ func playExample(file *ast.File, f *ast.FuncDecl) *ast.File {
                                }
                        }
 
-                       ast.Inspect(d.Body, inspectFunc)
+                       // Functions might not have a body. See #42706.
+                       if d.Body != nil {
+                               ast.Inspect(d.Body, inspectFunc)
+                       }
                case *ast.GenDecl:
                        for _, spec := range d.Specs {
                                switch s := spec.(type) {