]> Cypherpunks repositories - gostls13.git/commitdiff
ast/filter.go: missing nil-check causes crash
authorRobert Griesemer <gri@golang.org>
Fri, 12 Mar 2010 01:39:55 +0000 (17:39 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 12 Mar 2010 01:39:55 +0000 (17:39 -0800)
R=rsc
CC=golang-dev
https://golang.org/cl/461041

src/pkg/go/ast/filter.go

index 1c2aea35749c03d72a1d5a3e2c256a06e1235586..4e2060303be8b39c2039fe0a28b9316e9b844edb 100644 (file)
@@ -293,7 +293,7 @@ func MergePackageFiles(pkg *Package, complete bool) *File {
                                                name := f.Name.Name()
                                                if j, exists := funcs[name]; exists {
                                                        // function declared already
-                                                       if decls[j].(*FuncDecl).Doc == nil {
+                                                       if decls[j] != nil && decls[j].(*FuncDecl).Doc == nil {
                                                                // existing declaration has no documentation;
                                                                // ignore the existing declaration
                                                                decls[j] = nil