Add nil check when following Else in ast

Fixes #137
This commit is contained in:
Derek Parker
2015-06-21 11:48:22 -05:00
parent 38f97b4023
commit 5642e0a106

View File

@ -120,6 +120,7 @@ func (s *Searcher) NextLines(fname string, line int) (lines []int, err error) {
x = stmt
continue
}
if x.Else != nil {
pos := s.fileset.Position(x.Else.Pos())
ast.Inspect(x, func(n ast.Node) bool {
if found {
@ -138,6 +139,7 @@ func (s *Searcher) NextLines(fname string, line int) (lines []int, err error) {
})
}
}
}
// Follow case statements.
//