Skip to content

Commit

Permalink
added a check to parser to not panic
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSatimeWallin committed Sep 10, 2015
1 parent a89f14d commit f6d4629
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ func parserPkg(pkgRealpath, pkgpath string) error {
switch specDecl := d.(type) {
case *ast.FuncDecl:
if specDecl.Recv != nil {
parserComments(specDecl.Doc, specDecl.Name.String(), fmt.Sprint(specDecl.Recv.List[0].Type.(*ast.StarExpr).X), pkgpath)
exp, ok := specDecl.Recv.List[0].Type.(*ast.StarExpr) // Check that the type is correct first beforing throwing to parser
if ok {
parserComments(specDecl.Doc, specDecl.Name.String(), fmt.Sprint(exp.X), pkgpath)
}
}
}
}
Expand Down

0 comments on commit f6d4629

Please sign in to comment.